Boost logo

Boost Users :

From: Vivek Nallur (nallur_at_[hidden])
Date: 2007-11-09 12:57:23


Hi,

My project uses boost 1.34.1 libraries for asio and also includes
windows.h (which in turn includes winsock.h). This results in a macro
redefinition error for FD_SETSIZE and then goes on to spew a
bucketload of related errors.

The easiest way to reproduce this is to have a simple main.cpp with just:

#include<boost/asio.hpp>
#include<windows.h>
int main() { return 0; }

Any ideas on what I'm doing wrong? Or what I could try? I've tried
defining WIN32_LEAN_AND_MEAN, IPPROTO_V6 in the makefile, but to no
avail.

I'm using VC 8 on a windows XP.
========================
My comand line looks like this:
C:\perforce\some\path\>make main.o

-- Compile main.cpp...
c:/perforce/toolchain/win32/winsdk-6.1.6000/VC/bin/cl.exe -nologo
-Fdc:/perforce/some/path
somelib.pdb -Gm -EHsc -c -Zi -TP -GR -D_WIN32 -D_USRDLL
-D_WIN32_WINNT -DWINVER=0x0600 -D_WINDLL -D_MBCS -W3 -D_CRT_NO
NSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DUSERLEVEL -MDd -Od
-D_DEBUG -RTC1
-I"C:\perforce\toolchain\win32\boost-1.34.1\include"
-Ic:/perforce/toolchain/win32/winsdk-6.1.6000/Include
-Ic:/perforce/toolchain/win32/winsdk-6.1.6000/VC/include
-Ic:/perforce/toolchain/win32/winsdk-6.1.6000/VC/PlatformSDK/Include

And the error message looks like:
C:\perforce\toolchain\win32\boost-1.34.1\include\boost/asio/detail/socket_types.hpp(44)
: warning C4005: 'FD_SETSIZE' : macro redefinition
        c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\winsock.h(65)
: see previous definition of 'FD_SETSIZE'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(91) :
warning C4005: 'AF_IPX' : macro redefinition
        c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\winsock.h(460)
: see previous definition of 'AF_IPX'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(116) :
warning C4005: 'AF_MAX' : macro redefinition
        c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\winsock.h(479)
: see previous definition of 'AF_MAX'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(163) :
warning C4005: 'SO_DONTLINGER' : macro redefinition
        c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\winsock.h(402)
: see previous definition of 'SO_DONTLINGER'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(206) :
error C2011: 'sockaddr' : 'struct' type redefinition
        c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\winsock.h(485)
: see declaration of 'sockaddr'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(384) :
error C2143: syntax error : missing '}' before 'constant'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(437) :
error C2143: syntax error : missing ';' before '}'
c:\perforce\toolchain\win32\winsdk-6.1.6000\Include\ws2def.h(437)
:error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int

========================


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net