error LNK2001: unresolved external symbol

出现link2001的错误的解决办法:

 

--------------------Configuration: DlgReceive - Win32 Debug--------------------

Compiling...

DlgReceiveDlg.cpp

E:\(书)Visual C++ 6.0 数字图像编码\DlgReceive\DlgReceiveDlg.cpp(327) : warning C4700: local variable 'fp' used without having been initialized

Linking...

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__closesocket@4

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__recvfrom@24

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__bind@12

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__htons@4

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__socket@12

DlgReceiveDlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8

Debug/DlgReceive.exe : fatal error LNK1120: 8 unresolved externals

Error executing link.exe.

 

DlgReceive.exe - 9 error(s), 1 warning(s)

 

在project-> setting ->link ->object/library modules中添加:

ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

就不会出现上面的错误了。

原文地址:http://blog.163.com/liyani_1980/blog/static/38604145200971321352336/

你可能感兴趣的:(error LNK2001: unresolved external symbol)