开发者

Where is wctype in Visual C 2008 Express?

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.


Try this:

cl test.c /link MSVCPRT.LIB


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

http://msdn.microsoft.com/en-us/library/aa246681(VS.60).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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜