Unresolved External Symbol _ntohl, _htons, _setsockopt, etc.
Article ID: C01060 Last updated: 2003/02/18 |
When building a CodeBase client application and linking to c4lib.lib, the linker may generate unresolved external symbol errors for the following symbols:
- _accept@12
- _bind@12
- _closesocket@4
- _connect@12
- _gethostbyname@4
- _getpeername@12
- _getsockname@12
- _getsockopt@20
- _htonl@4
- _htons@4
- _inet_addr@4
- _ioctlsocket@12
- _listen@8
- _ntohl@4
- _ntohs@4
- _recv@16
- _select@20
- _send@16
- _setsockopt@20
- _socket@12
- _WSACleanup@0
- ___WSAFDIsSet@8
- _WSAGetLastError@0
- _WSAStartup@8
Solution
These symbols represent functions that are used by CodeBase for client/server communication. If you receive these errors when you link your application, it means that you are not linking to the Windows Socket DLL. In your project settings, add wsock32.lib to the libraries that link to your application.