关于error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
题目:关于error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
问题描述:Deleting intermediate files and output files for project 'WSAChat - Win32 Debug'.
--------------------Configuration: WSAChat - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
WSAChat.cpp
WSAChatDlg.cpp
Generating Code...
Linking...
LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
WSAChat.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
WSAChat.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSAAsyncSelect@16
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__bind@12
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__htons@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__htonl@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSASocketA@24
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSARecvFrom@36
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSASendTo@36
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
Debug/WSAChat.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
Creating browse info file...
WSAChat.exe - 12 error(s), 2 warning(s)
解决方法:Project->Settings->Link->Object/libary modules:加上ws2_32.lib