關於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")