Getting heaps (105) of redefine & syntax errors when trying to compile my VS2008 c++ project with <winsock2.h>
included. Running Windows 7 64bit.
I have googled and searched and the answer seems pretty uniform but it doesn't seem to work for me.
Tried putting #include <winsock2.h>
before #include <windows.h>
. Also tried not including <windows.h>
(as winsock2 includes it automatically if missing).
Tried with #define WIN32_LEAN_AND_MEAN
and/or #define _WINSOCKAPI_
prior.
In the linker -> additional dependencies I have referenced ws2_32.lib.
Also tried #pragma comment(lib, "ws2_32.lib")
.
I rebuild the whole solution just in case.
Usual error (shared by many it seems):
Error 5 error C2011: 'sockaddr' : 'struct' type redefinition c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h 206 RallyAction
Error 6 error C2143: syntax error : missing '}' before 'constant' c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h 384 RallyAction
Error 7 error C2143: syntax error : missing ';' before 'constant' c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h 384 RallyAction
Error 8 error C2059: syntax error : 'constant' c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h 384 RallyAction
...etc,etc.
Any suggestions would be appreciated.