Y
yeow
Unregistered / Unconfirmed
GUEST, unregistred user!
我在写一个WinSock服务器,其中调用了一个WinSock的标准API:WSASocket。
头文件我是这样包含的:#include <winsock2.h> //只有这一个头文件
结果链接的时候报错:[Linker Error] Unresolved external 'WSASocketA' referenced from E:/PROJECTS/HTTP_SERVER/IOCP_SVR.OBJ
我检查winsock2.h里面,WSASocketA明明是有定义的:
[blue]
#if INCL_WINSOCK_API_PROTOTYPES
WINSOCK_API_LINKAGE
SOCKET
WSAAPI
WSASocketA(
IN int af,
IN int type,
IN int protocol,
IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags
);
WINSOCK_API_LINKAGE
SOCKET
WSAAPI
WSASocketW(
IN int af,
IN int type,
IN int protocol,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags
);
#ifdef UNICODE
#define WSASocket WSASocketW
#else
#define WSASocket WSASocketA
#endif /* !UNICODE */
#endif /* INCL_WINSOCK_API_PROTOTYPES */
[/blue]
程序语法没有问题。百思不得其解,希望得到您的帮助!谢谢啦。
头文件我是这样包含的:#include <winsock2.h> //只有这一个头文件
结果链接的时候报错:[Linker Error] Unresolved external 'WSASocketA' referenced from E:/PROJECTS/HTTP_SERVER/IOCP_SVR.OBJ
我检查winsock2.h里面,WSASocketA明明是有定义的:
[blue]
#if INCL_WINSOCK_API_PROTOTYPES
WINSOCK_API_LINKAGE
SOCKET
WSAAPI
WSASocketA(
IN int af,
IN int type,
IN int protocol,
IN LPWSAPROTOCOL_INFOA lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags
);
WINSOCK_API_LINKAGE
SOCKET
WSAAPI
WSASocketW(
IN int af,
IN int type,
IN int protocol,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags
);
#ifdef UNICODE
#define WSASocket WSASocketW
#else
#define WSASocket WSASocketA
#endif /* !UNICODE */
#endif /* INCL_WINSOCK_API_PROTOTYPES */
[/blue]
程序语法没有问题。百思不得其解,希望得到您的帮助!谢谢啦。