Winsock error for no reason?
Feb 9, 2014 at 4:59pm UTC
I've been leaning how to do multiplayer stuff with a library called Enet and Allegro. Today I decided to work on it some more. When I tried to run it, it gave me a lot of weird errors that I think have to do with winsock. I undid everything that I was working on and it still gave the weird errors. I have no idea why it would randomly mess itself up... Here is the list of errors. Well the error was way too long. Tell me if you need to see the rest of it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
1
1> main.cpp
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(91): warning C4005: 'AF_IPX' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(460) : see previous definition of 'AF_IPX'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(131): warning C4005: 'AF_MAX' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(479) : see previous definition of 'AF_MAX'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(168): warning C4005: 'SO_DONTLINGER' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(402) : see previous definition of 'SO_DONTLINGER'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(212): error C2011: 'sockaddr' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(485) : see declaration of 'sockaddr'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(390): error C2059: syntax error : 'constant'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(390): error C3805: 'constant': unexpected token, expected either '}' or a ','
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(524): warning C4005: 'IN_CLASSA' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(287) : see previous definition of 'IN_CLASSA'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(530): warning C4005: 'IN_CLASSB' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(293) : see previous definition of 'IN_CLASSB'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(536): warning C4005: 'IN_CLASSC' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(299) : see previous definition of 'IN_CLASSC'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(547): warning C4005: 'INADDR_ANY' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(304) : see previous definition of 'INADDR_ANY'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(549): warning C4005: 'INADDR_BROADCAST' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(306) : see previous definition of 'INADDR_BROADCAST'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h(583): error C2011: 'sockaddr_in' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(312) : see declaration of 'sockaddr_in'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(132): error C2011: 'fd_set' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(68) : see declaration of 'fd_set'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(167): warning C4005: 'FD_SET' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(102) : see previous definition of 'FD_SET'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(176): error C2011: 'timeval' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(111) : see declaration of 'timeval'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(232): error C2011: 'hostent' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(167) : see declaration of 'hostent'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(245): error C2011: 'netent' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(180) : see declaration of 'netent'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(252): error C2011: 'servent' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(187) : see declaration of 'servent'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(264): error C2011: 'protoent' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(199) : see declaration of 'protoent'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(360): error C2011: 'WSAData' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(322) : see declaration of 'WSAData'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(458): error C2011: 'sockproto' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(494) : see declaration of 'sockproto'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(500): error C2011: 'linger' : 'struct' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(531) : see declaration of 'linger'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(513): warning C4005: 'SOMAXCONN' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(544) : see previous definition of 'SOMAXCONN'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(542): warning C4005: 'FD_READ' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(562) : see previous definition of 'FD_READ'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(545): warning C4005: 'FD_WRITE' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(563) : see previous definition of 'FD_WRITE'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(548): warning C4005: 'FD_OOB' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(564) : see previous definition of 'FD_OOB'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(551): warning C4005: 'FD_ACCEPT' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(565) : see previous definition of 'FD_ACCEPT'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h(554): warning C4005: 'FD_CONNECT' : macro redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock.h(566) : see previous definition of 'FD_CONNECT'
Feb 9, 2014 at 5:23pm UTC
Yeah this one aggravates me all the time too. You need to add #define WIN32_LEAN_AND_MEAN
to the top of your project before including 'windows.h' to prevent it from including the older 'winsock.h' file which conflicts with 'winsock2.h'.
Feb 9, 2014 at 5:26pm UTC
Oh wow nice simple solution. Thanks!
Topic archived. No new replies allowed.