编译时出现error LNK2001: unresolved external symbol __imp__htons@4

来源:百度文库 编辑:神马文学网 时间:2024/04/28 09:04:35
编译时出现:Linking...
CADTest.obj : error LNK2001: unresolved external symbol __imp__htons@4
Debug/CADTest.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
 在工程中要包含要包含ws2_32.lib文件  解决方法:
方法1.在project->setting中,打开link选项卡,在project options中加上ws2_32.lib
方法2.在文件中加上#progmma comment(lib, "ws2_32.lib")