error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function

用vs2005编译udp  socket的时候,出现这个连接错误:

1>Sever.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__sendto@24 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__recvfrom@24 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _main
1>Sever.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main

解决方法:

在link下 加上:Ws2_32.lib 

就能编译通过了!

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页