On 26 April 2011 13:40, Anna Ceguerra wrote: > Hi, > > > On 26/04/11 26/04/11 9:07 PM, "Jonathan Wakely" <jwakely.gcc@xxxxxxxxx> > wrote: > >> On 26 April 2011 01:52, Anna Ceguerra wrote: >>> >>> Thanks for your reply, it successfully built in one go, and I successfully >>> installed it. However when I try to compile using the new compiler, I get >>> the following error: >>> >>> /usr/local/lib/gcc/i386-apple-darwin10.7.0/4.6.1/../../../../include/c++/4.6 >>> .1/tr1/special_function_util.h: In function ‘bool >>> std::tr1::__detail::__isnan(_Tp)’: >>> /usr/local/lib/gcc/i386-apple-darwin10.7.0/4.6.1/../../../../include/c++/4.6 >>> .1/tr1/special_function_util.h:113:19: error: expected unqualified-id before >>> ‘(’ token >>> >>> This is the relevant section in the file: >>> >>> #if _GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC >>> >>> /// This is a wrapper for the isnan function. Otherwise, for NaN, >>> /// all comparisons result in false. If/when we build a std::isnan >>> /// out of intrinsics, this will disappear completely in favor of >>> /// std::isnan. >>> template<typename _Tp> >>> inline bool __isnan(const _Tp __x) >>> { >>> return std::isnan(__x); // it is failing here >>> } >>> >>> #else >>> >>> template<typename _Tp> >>> inline bool __isnan(const _Tp __x) >>> { >>> return __builtin_isnan(__x); >>> } >>> >>> template<> >>> inline bool __isnan<float>(const float __x) >>> { >>> return __builtin_isnanf(__x); >>> } >>> >>> template<> >>> inline bool __isnan<long double>(const long double __x) >>> { >>> return __builtin_isnanl(__x); >>> } >>> >>> #endif >>> >>> Am I configuring the program incorrectly? >> >> It's impossible to know because you haven't shown your program. It >> might be a bug in the library, I don't think i386-darwin is a very >> well tested configuration, or it could be something you've done wrong. >> >> Please try to reproduce the error with a minimal example to show >> whether you get that error just from including a header, or only under >> certain circumstances. > > I managed to track it down to the following test.cpp file: > > #include <cmath> > #include <mgl/mgl.h> > #include <algorithm> > > Where mgl is from the wxWidgets library, version 2.8.11 > > When I changed the order to: > #include <cmath> > #include <algorithm> > #include <mgl/mgl.h> > > It worked. That would imply the mgl.h header does something it shouldn't, such as defining isnan as a macro, or something else which breaks the standard library header. Glad you got it working.