必胜客有团购吗:IPAddressDlg.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0是什么 意思

来源:百度文库 编辑:高考问答 时间:2024/04/24 15:48:52
我在写一个网络程序
结果编译时出现IPAddressDlg.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
的错误类似的还有好多
已包含头文件winsock2.h
为什么啊
谢谢了
我已经知道了
在setting 里 link里加入wsock32.lib就可以了

WSACleanup 确实是 winsock2.h里声明过的,你试试下面的两种方法,如果都不行,我也没办法了.
第一,你在程序中声明用winsock的2.2版本,即,在开始使用套接字之前声明
WORD wVersionRequested;
WSADATA wsaData;
int err;

wVersionRequested = MAKEWORD( 2, 2 );

err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return;
}

/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */

if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup( );
return;
}
第二,在vc的工具菜单(Tool),选择"选择"(Option),选择"目录"(directory)选项卡,在"显示目录为(S)"中选择"Include files"将"D:\Program files\Visual studio\vc98\includes"提到最高