项目—〉属性-〉链接器->输入->附加依赖项,在其中填入ws2_32.lib
--------------------------------------------------------
Project->Property->Linker->Command Line
在下面的对话框里输入你的库名,也就是ws2_32.lib
apply
然后#include ws2_32.h
----------------------------------------------------
--------------------------------------------------------
Project->Property->Linker->Command Line
在下面的对话框里输入你的库名,也就是ws2_32.lib
apply
然后#include ws2_32.h
----------------------------------------------------
#include <winsock2.h>
#pragma comment(lib, "WS2_32")