Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 带正弦和boost的gcc编译错误:间隔_C++_Boost - Fatal编程技术网

C++ 带正弦和boost的gcc编译错误:间隔

C++ 带正弦和boost的gcc编译错误:间隔,c++,boost,C++,Boost,我需要在安装了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 Int

我需要在安装了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>
      >
  >;
在我的本地机器mac上,用叮当声编译非常好。但是,只要我尝试在服务器上运行它,使用
g++-std=c++11 test.cpp编译,我就会得到错误:

/usr/include/boost/numeric/interval/rounded_arith.hpp:71:59:错误: “to_int”未在此作用域中声明,也未进行任何声明 在实例化点通过参数相关查找找到 [-fppermissive]T int_down(const T&x){this->down();返回 to_int(x);} ~~~~~~^~~~/usr/include/boost/numeric/interval/rounded\u arith.hpp:71:59:注意: 依赖基中的声明 找不到“boost::numeric::interval\u lib::detail::c99\u舍入” 非限定查找 /usr/include/boost/numeric/interval/rounded_arith.hpp:71:59:注意:使用 改为“this->to_int”


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

编译这篇文章的boost的第一个版本是1.58

  • 错误

编译此文件的boost的第一个版本是1.58

  • 错误

显示确切的编译命令,并提供一些@BasileStarynkevitch添加的编译命令。关于我的示例,什么是不最小、不完整或不可验证的?不,您确实给出了一个(如果两个代码块一起)顺便问一下,您确定您只有一个版本的boost吗?您是否使用
-H
(传递到
g++
clang++
)检查相同的
boost/numeric/interval.hpp
是否包含在这两种情况中?什么版本的Boost?@BasileStarynkevitch这似乎确实是个问题,Boost可能有几个版本。我刚刚在那里找到了版本1.41,加上sehes的答案,这将无法编译。感谢您展示了确切的编译命令,并提供了一些@BasileStarynkevitch添加的编译命令。关于我的示例,什么是不最小、不完整或不可验证的?不,您确实给出了一个(如果两个代码块一起)顺便问一下,您确定您只有一个版本的boost吗?您是否使用
-H
(传递到
g++
clang++
)检查相同的
boost/numeric/interval.hpp
是否包含在这两种情况中?什么版本的Boost?@BasileStarynkevitch这似乎确实是个问题,Boost可能有几个版本。我刚刚在那里找到了版本1.41,加上sehes的答案,这将无法编译。非常感谢。
// still test.cpp
int main() 
{
    Interval iv_arg {1.0};
    Interval res = sin(iv_arg);
}