Use this file to include winsock2.h. More...
#include <winsock2.h>#include <ws2tcpip.h>
Go to the source code of this file.
Use this file to include winsock2.h.
This file fixes the issue where winsock2.h has to be included before windows.h.
The source of this error comes from the fact that if <windows.h> is included before <winsock2.h>, <windows.h> will include <winsock.h>, which is the older version of the winsock library. After that, if the user includes winsock2.h, he will get compilation errors.
To fix this problem, do one of the following:
1) Alter the inclusion order in the compilation unit(s) so that you explicitly include <winsock2.h> before including windows.h. 2) Add a define _WINSOCKAPI_ either to project settings, or at the top of the offending compilation unit (before including windows.h). Use this solution when you don't want to alter the inclusion order to the proper desired order (winsock2.h before windows.h)
1.7.1