Visual C 2008 Express 中的 wctype 位于何处?
-
22-09-2019 - |
题
我正在使用 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”函数,因为它会让原始开发人员感到困惑。
感谢您的耐心等待。
附:我还使用 Dependency Walker 查看了 MSVCRT90.DLL 文件的导入表,并且没有“wctype”函数。
解决方案
尝试这种情况:
cl test.c /link MSVCPRT.LIB
其他提示
您需要与libcp.lib链接这里提到:
如果您使用 msvcprt.lib,则必须根据您的设置重新分发 DLL(例如MSVCP90.dll)。如果您不想重新分发,请尝试以下操作:
cl test.c /link libcpmt.lib
所有要链接的库的列表都在这里(看底部): http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx
不隶属于 StackOverflow