Error building Boost 1.49.0 with GCC 4.7.0

boost, c++, mingw

Solution

Found the answer in this forum post. It seems that pyconfig.h has the following lines:

#if defined(__GNUC__) && defined(_WIN32)
// ...
#define hypot _hypot
// ...
#endif /* GNUC */

but cmath included with MinGW expects the function to be named `hypot` and not `_hypot`, which causes the compilation errors.

The fix was to include the following to my bjam command line's cxxflags option

bjam ... cxxflags="-include cmath "

This indicates that g++ should include the cmath header at the beginning of every source file.

Problem

I'm trying to build Boost 1.49.0 using GCC 4.7.0 (MinGW). I keep getting the following error message several dozen times: c:\tools\mingw\bin../lib/gcc/i686-pc-mingw32/4.7.0/../../../../include/c++/4.7.0/cmath:1096:11: error: '::hypot' has not been declared Line 1096 of `cmath` contains ``` using ::hypot; ``` `cmath` includes `math.h` which declares the `hypot` function as ``` extern double __cdecl hypot (double, double); /* in libmoldname.a */ ``` In both files, a couple of lines after the ones quoted above, are identical statements for the `hypotl` function (except the type is `long double` instead of `double`) and that one seems happy. Any ideas why I am getting this error?

Original source