关于ntohl和htohl两个函数,在程序内include "winsock2.h"后,
出现link error:unresolved external symbol_imp_htonl@4。
两个解决方案:
1、你可以选择“Project|Settings”,在Link标签的Object/library modules部分加上所需的.LIB文件。
如果你不知道哪个文件是你要的,可以在msdn内找到。
例如htohl的msdn信息:
QuickInfo
Windows NT: Yes
Windows: Yes
Windows CE: Use version 1.0 and later.
Header: Declared in winsock2.h.
Import Library: Link with ws2_32.lib.
2、程序内加上:#pragma comment(lib,"ws2_32")