redefinition errors in WinSock2.h [duplicate]

My educated guess would be the order of included headers, i.e. include winsock2.h first (with first meaning before windows.h), or define WIN32_LEAN_AND_MEAN before including windows.h, which prevents windows.h from including winsock v1.

#include <winsock2.h>
#include <windows.h>

-or-

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>

Leave a Comment