加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 使用GCC 4.7.0构建Boost 1.49.0错误

发布时间:2020-12-16 03:13:48 所属栏目:百科 来源:网络整理
导读:我正在使用GCC 4.7.0(MinGW)构建Boost 1.49.0.我收到以下错误信息几十次: c:toolsmingwbin../lib/gcc/i686-pc-mingw32/4.7.0/../../../../include/c++/4.7.0/cmath:1096:11: error: ‘::hypot’ has not been declared cmath的第1096行包含 using ::hypo
我正在使用GCC 4.7.0(MinGW)构建Boost 1.49.0.我收到以下错误信息几十次:

c:toolsmingwbin../lib/gcc/i686-pc-mingw32/4.7.0/../../../../include/c++/4.7.0/cmath:1096:11: error: ‘::hypot’ has not been declared

cmath的第1096行包含

using ::hypot;

cmath包括math.h,它将hypot函数声明为

extern double __cdecl hypot (double,double); /* in libmoldname.a */

在两个文件中,上面引用的几行都是相同的用于hypotl函数的语句(除了类型是long double而不是double),而且似乎很开心.

任何想法为什么我得到这个错误?

解决方法

找到答案在 this forum post.似乎pyconfig.h有以下几行:
#if defined(__GNUC__) && defined(_WIN32)
// ...
#define hypot _hypot
// ...
#endif /* GNUC */

但是MinGW中包含的cmath会将函数命名为hypot而不是_hypot,这会导致编译错误.

修复是将以下内容添加到我的bjam命令行的cxxflags选项中

bjam ... cxxflags="-include cmath "

这表示g应该在每个源文件的开始处包含cmath头.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读