在使用CodeBlocks12.11进行编译的时候,出现
undefined reference to `WSAGetLastError@0'
undefined reference to `WSAStartup@8'
undefined reference to `socket@12'
等未定义错误。
解决办法:
1 下载文件ws2_32.lib http://pan.baidu.com/s/1mg7G7SO
2 将文件解压。
3 CodeBlocks-->设置-->compiler-->链接器设置-->链接库--->添加。
4 将解压缩的WS2_32.Lib文件,添加到链接库。
5 重新编译