Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

c++ - Error building Boost 1.49.0 with GCC 4.7.0

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:oolsmingwin../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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The answer by @Praetorian correctly identifies the problem. On the other hand, the Python headers are technically meant to come before any others. In addition, sometimes the accepted solution does not work or is inconvenient in the build system, so I came up with an alternate solution. Add the following flag to the call to g++:

-D_hypot=hypot

This makes it so that the harmful macro in the Python headers becomes a no-op, and the compilation error goes away.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...