读书人

STL的lt;ALGORITHMgt;和WINSOCK2的兼容有关

发布时间: 2012-03-11 18:15:38 作者: rapoo

STL的<ALGORITHM>和WINSOCK2的兼容问题
我在vc6中同时使用std::find算法与WINSOCK2就会出现关于WINSOCK2中所有变量类型和函数的错误。
error LNK2001: unresolved external symbol __imp__connect@12
error LNK2001: unresolved external symbol __imp__htons@4
error LNK2001: unresolved external symbol __imp__WSAAsyncSelect@16
error LNK2001: unresolved external symbol __imp__socket@12
error LNK2001: unresolved external symbol __imp__inet_addr@4
error LNK2001: unresolved external symbol __imp__listen@8
error LNK2001: unresolved external symbol __imp__bind@12
error LNK2001: unresolved external symbol __imp__send@16
error LNK2001: unresolved external symbol __imp__recv@16
error LNK2001: unresolved external symbol __imp__closesocket@4
error LNK2001: unresolved external symbol __imp__accept@12
error LNK2001: unresolved external symbol __imp__inet_ntoa@4
error LNK2001: unresolved external symbol __imp__ntohs@4
error LNK2001: unresolved external symbol __imp__getpeername@12
error LNK2001: unresolved external symbol __imp__WSAStartup@8
若不加#include <ALGORITHM> ,上面的错误就都没了,但是我就不能使用std::find函数了。求大牛解释呀。。。

[解决办法]
链接问题?强制指定项目链接到 ws2_32.lib 呢?
[解决办法]
强制指定项目链接到 ws2_32.lib

读书人网 >C++

热点推荐