简体   繁体   中英

visual studio compiler?

我尝试完成教程,但是我不知道该使用哪个VS 2008项目,因为我尝试的所有操作都给我一个error C2731: 'wWinMain' : function cannot be overloaded错误(对于Win32项目,在教程中使用WINAPI WinMain()方法更改APIENTRY _tWinMain() ,或出现许多错误,例如error LNK2019: unresolved external symbol _closesocket@4 referenced in function _WinMain@16

Quote from the same tutorial:

Remember that any code presented in this tutorial should be linked with the Winsock library, usually wsock32.lib or something similarly named. Also, when using code exactly as presented in the tutorial in your own IDE (Dev-C++, Microsoft VC++, C++ Builder, etc.), choose to build a Windows project with a WinMain() to avoid errors.

To accomplish this use either:

#pragma comment(lib, "wsock32.lib")

in your source file (doesn't matter much which), or add it to the Project Linker options.

Also note that according to the latest MSDN documentation , the correct library name is Ws2_32.lib .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM