Error between winsock2.h and ws2def.h
landscht opened this issue · 2 comments
landscht commented
I simply include "HttpRequest.cpp" and at compile time I have 161 errors of this type :
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winsock.h(457): message : voir la définition précédente de 'AF_IPX'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(147,1): warning C4005: 'AF_MAX' : redéfinition de macro
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winsock.h(476): message : voir la définition précédente de 'AF_MAX'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(185,1): warning C4005: 'SO_DONTLINGER' : redéfinition de macro
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winsock.h(399): message : voir la définition précédente de 'SO_DONTLINGER'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(238,25): error C2011: 'sockaddr' : redéfinition du type 'struct'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winsock.h(1007): message : voir la déclaration de 'sockaddr'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(440,5): error C2143: erreur de syntaxe : absence de '}' avant 'constante'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(440,27): error C2059: erreur de syntaxe : 'constante'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ws2def.h(494,1): error C2143: erreur de syntaxe : absence de ';' avant '}'```
I tried a lot of solutions like including windows.h before httprequest.cpp but nothing works
AVISIX commented
I have the same issue.
Anyone got a clue how this can be resolved?
Deleted user commented
#define WIN32_LEAN_AND_MEAN
#include <HTTPRequest.hpp>
#pragma comment(lib, "ws2_32.lib")