Why am I getting linker errors for ws2_32.dll in my C program?

I am writing my program in Visual Studio 2010. I cannot associate a file with a name ws2_32.dllwith my project.

Can someone tell me how can I do this?

+5
source share
3 answers

Usually you do not refer to ws2_32.dll directly , but to WS2_32.Lib, which you can find in the Windows SDK. Therefore, in the code you write

#include <winsock2.h>

and you add WS2_32.Lib to your linker settings, and you're good to go.

Windows SDK is here:

http://msdn.microsoft.com/en-us/windows/bb980924.aspx

+7
source

- , , ws2_32.dll. , , :

#include <winsock2.h>

, DLL. Visual Studio , - :

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

" " ( " " → " " → "" → "Enter" ).

MSDN , Winsock. , , .

+6
0

All Articles