Group: comp.lang.c++
From: Vaclav Haisman
Date: Sunday, February 17, 2008 2:57 PM
Subject: Re: MinGW not so good with exceptions?

Dave the Funkatron wrote, On 17.2.2008 10:27:
> Hey all,
>
> I'm using MinGW as part of my toolchain in Eclipse, and I am trying to
> figure out why I am getting a compiler error when I include the
> header.
>
> The command that eclipse is running is
>
> g++ -IC:\Dave\School\common\cxx -IC:\Dave\School\common\third party
> \packages\glut-3.7.6-bin\include -IC:\Dave\School\common\third party
> \packages\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
> fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.cpp
>
>
>
> The error I get is:
>
> In file included from C:/Dave/School/common/cxx/math/math_utils.h:13,
> from C:/Dave/School/common/cxx/gfx2d/color.h:9,
> from C:/Dave/School/common/cxx/gllib/gl_light.h:
> 6, from ..\gllib\test_gllib.cpp:8:C:/mingw/bin/../lib/
> gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/limits:290: error:
> expected `;' before "throw"
> C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
> limits:292: error: expected `;' before "static"
> C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
> limits:292:22: macro "max" requires 2 arguments, but only 1 given
That's problem with windows.h header. It or one of headers it includes
defines macros min() and max() and those expand inside the C++ headers and
result in the error.

You should be able to fix it by making sure windows.h is included only after
any standard C++ header. Or you can #undef min and #undef max before any
standard C++ header. Or you can define NOMINMAX symbol before including
windows.h so that it does not define the two macros.

--
VH

Safety Articles | Usenet Groups | Usenet News | Bluegrass