gpt4 book ai didi

c++ - gcc 正弦和 boost 编译错误 :interval

转载 作者:行者123 更新时间:2023-11-30 01:37:52 31 4
gpt4 key购买 nike

我需要在安装了 gcc/g++ (7.2.0) 和 boost (1.66) 的 linux (CentOs 6.7) 服务器上运行一些代码(编辑: 不仅是 1.66,还有一个旧版本boost 版本受到干扰。保持机器清洁伙计们)。我使用如下策略指定了我的间隔类型:

// test.cpp
#include <boost/numeric/interval.hpp>

namespace bn = boost::numeric;
namespace bi = bn::interval_lib;

using Interval = bn::interval<
double,
bi::policies<
bi::save_state<bi::rounded_transc_std<double> >,
bi::checking_base<double>
>
>;

现在我想做一些简单的计算,比如:

// still test.cpp
int main()
{
Interval iv_arg {1.0};
Interval res = sin(iv_arg);
}

在我的本地机器上,一台 mac,用 clang 编译工作得很好。但是,一旦我尝试在服务器上运行它,使用 g++ -std=c++11 test.cpp 编译,我就收到了错误:

/usr/include/boost/numeric/interval/rounded_arith.hpp:71:59: error: 'to_int' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] T int_down(const T& x) { this->downward(); return to_int(x); } ~~~~~~^~~ /usr/include/boost/numeric/interval/rounded_arith.hpp:71:59: note: declarations in dependent base 'boost::numeric::interval_lib::detail::c99_rounding' are not found by unqualified lookup /usr/include/boost/numeric/interval/rounded_arith.hpp:71:59: note: use 'this->to_int' instead

还有一些信息似乎与主题无关,但如果有帮助,我可以将其包括在内。我试着谷歌了一下,但找不到任何相关的东西。如果可能的话,我想找到一个不需要对服务器进行任何更改的解决方案。有没有人有过类似的想法或遇到过类似的问题?

最佳答案

编译它的第一个 boost 版本是 1.58

关于c++ - gcc 正弦和 boost 编译错误 :interval,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48927472/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com