使用sine和boost编译错误:interval

时间:2018-02-22 12:30:28

标签: c++ boost

我需要在安装了gcc / g ++(7.2.0)和增强版(1.66)的linux(CentOs 6.7)服务器上运行一些代码(编辑:不仅仅是1.66,更老了升级干扰的版本。让你的机器保持干净)。我用如下的策略指定了我的间隔类型:

// 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);
}

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

  

/usr/include/boost/numeric/interval/rounded_arith.hpp:71:59:错误:   'to_int'未在此范围内声明,并且没有声明   在实例化时通过参数依赖查找找到   [-fpermissive] T int_down(const T&amp; x){this-&gt; downward();返回   to_int(X); }                                                        ~~~~~~ ^ ~~ / usr /include/boost/numeric/interval/rounded_arith.hpp:71:59:注意:   依赖基础中的声明   找不到'boost :: numeric :: interval_lib :: detail :: c99_rounding'   不合格的查找   /usr/include/boost/numeric/interval/rounded_arith.hpp:71:59:注意:使用   'this-&gt; to_int'而不是

还有一些与该主题无关的信息,但如果可能有帮助,我可以加入。我尝试谷歌一点但找不到任何相关的东西。如果可能的话,我想找到一个不需要在服务器上进行任何更改的解决方案。有没有人有想法或遇到过类似的问题?

1 个答案:

答案 0 :(得分:4)

编译它的第一版boost是1.58