Visual C 2008 Express 中的 wctype 位于何处?

发布于 2024-08-17 05:41:22 字数 1022 浏览 9 评论 0原文

我正在使用 Visual C 2008 Express 将第 3 方软件从 Linux 移植到 Windows。

我只在函数“wctype”上遇到麻烦。它在 %VCDIR%/include/wctype.h 文件中声明如下:

 _MRTIMP2 wctype_t __cdecl wctype (const char *);

但是,当尝试链接时出现以下错误:

C:\test>cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj
test.obj : error LNK2019: unresolved external symbol _wctype referenced in function _main
test.exe : fatal error LNK1120: 1 unresolved externals

测试代码如下:

#include <wctype.h>

int
main (void)
{
  return (int) wctype ("alpha");
}

正如您在错误消息中看到的,代码编译正常,但无法链接。

该怎么办?我不是这个软件的开发人员,所以我不想用另一个函数替换“wctype”函数,因为它会让原始开发人员感到困惑。

感谢您的耐心等待。

PS 我还使用 Dependency Walker 查看了 MSVCRT90.DLL 文件的导入表,并且没有“wctype”函数。

I'm porting 3rd party software from Linux to Windows using Visual C 2008 Express.

I have trouble only with function `wctype'. It's declared in %VCDIR%/include/wctype.h file as follow:

 _MRTIMP2 wctype_t __cdecl wctype (const char *);

But, when trying to link a have the following error:

C:\test>cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj
test.obj : error LNK2019: unresolved external symbol _wctype referenced in function _main
test.exe : fatal error LNK1120: 1 unresolved externals

The test code is following:

#include <wctype.h>

int
main (void)
{
  return (int) wctype ("alpha");
}

As you can see in error message, code is compiling OK, but cannot link.

What to do? I'm not a developer of this software, so I don't want to replace `wctype' function with another, because it can confuse original developers.

Thanks for patience.

P.S. I've also looked at MSVCRT90.DLL file's import table with Dependency Walker and there are no `wctype' function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鸢与 2024-08-24 05:41:22

试试这个:

cl test.c /link MSVCPRT.LIB

Try this:

cl test.c /link MSVCPRT.LIB

虚拟世界 2024-08-24 05:41:22

您需要链接到 libcp.lib,如下所述:

http ://msdn.microsoft.com/en-us/library/aa246681(VS.60).aspx

You need to link with libcp.lib as mentioned here:

http://msdn.microsoft.com/en-us/library/aa246681(VS.60).aspx

雨落星ぅ辰 2024-08-24 05:41:22

如果您使用msvcprt.lib,则必须根据您的设置重新分发DLL(例如MSVCP90.dll)。如果您不想重新分发,请尝试以下操作:

cl test.c /link libcpmt.lib

此处列出了要链接到的所有库(请查看底部):http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx

If you use msvcprt.lib you'll have to redistribute a DLL depending on your setup (e.g. MSVCP90.dll). If you don't want to redistribute try this:

cl test.c /link libcpmt.lib

A list of all the libraries to link to are here (look at the bottom): http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文