Question

i try to complete this tutorial, but i don't know what VS 2008 project to use for it, as everything that i tried gave me either a error C2731: 'wWinMain' : function cannot be overloaded error (for a Win32 project where i change the APIENTRY _tWinMain() with WINAPI WinMain() method from the tutorial), or many errors like error LNK2019: unresolved external symbol _closesocket@4 referenced in function _WinMain@16.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top