更新时间:2022-12-16 09:14:30
如果看一下ws2tcpip.h的第297行,您会看到对_WIN32_WINNT的值进行了检查.
If you have a look at line 297 of ws2tcpip.h, you can see that there's a check of the value of _WIN32_WINNT.
#if (_WIN32_WINNT >= 0x0501)
void WSAAPI freeaddrinfo (struct addrinfo*);
int WSAAPI getaddrinfo (const char*,const char*,const struct addrinfo*,
struct addrinfo**);
int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
char*,DWORD,int);
#else
/* FIXME: Need WS protocol-independent API helpers. */
#endif
只需在包含之前#define _WIN32_WINNT
.
Just #define _WIN32_WINNT
before your includes.