Winsock redefinition errors [duplicate] Winsock redefinition errors [duplicate] windows windows

Winsock redefinition errors [duplicate]


Your problem is that by including Windows.h, you are also already including winsock.h. It is here your problem arises as including winsock2.h or ws2tcpip.h will attempt to redefine some of the definitions in winsock.h

By using #define WIN32_LEAN_AND_MEAN before your Windows.h include you stop the compiler from including a lot of the extra stuff that comes with Windows.h