c++ - 在 boost 库之间找不到 cpp_bin_float

标签 c++ c++11 ubuntu boost compiler-errors

我正在使用 boost 库来处理大数字。

#include <iostream>
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <boost/multiprecision/number.hpp>

namespace mp=boost::multiprecision;

using namespace std;

int main()
{
typedef mp::number<mp::backends::cpp_bin_float<2000> > cpp_bin_float227;
    cpp_bin_float227 b = 998;
   std::cout << std::numeric_limits<cpp_bin_float227>::digits << std::endl;
   cout<<std::setprecision(std::numeric_limits<cpp_bin_float227>::max_digits10)<<pow(b,9999)<<endl;
}

但是我在编译时遇到了这个错误:

fatal error: boost/multiprecision/cpp_bin_float.hpp: No such file or directory
 #include <boost/multiprecision/cpp_bin_float.hpp>

如果我使用 cpp_dec_float 而不是 cpp_bin_float,它工作正常。 为什么找不到库以及如何修复它?

(我在 Ubuntu 中使用 c++11 编译器)

解决方案: 问题是在 answe 中,即旧版本的 boost 库。 支持 cpp_bin_float 的最低版本是 1.58

删除当前版本:

apt-get --purge remove libboost-dev libboost-doc

后来我安装了1.63版本(不是最新的1.64)

http://www.linuxfromscratch.org/blfs/view/cvs/general/boost.html

最佳答案

那个版本的 boost 没有 cpp_bin_float。它也很老了。

现场观看:

关于c++ - 在 boost 库之间找不到 cpp_bin_float,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45212589/

相关文章:

c++ - 迁移到 C++11 时出现不等式比较结果未使用警告

c++ - std::sort() 和 std::sort_heap() 的内存复杂度是多少?

ubuntu - kubernetes build/run.sh 在 ubuntu 16.04 上失败并显示!!! build/../build/common.sh 中的错误 :546

python - 卸载 opencv 2.4.9 并安装 3.0.0

c++ - '_T' 未在此范围内声明?

c++ - 设计可定制的字符串过滤器

C++ 模板在模板函数实例化时类型未知

c++ - 函数指针的静态映射

c++ - 如何在 cmake 中的源文件后设置库标志?

PHP 函数 mail() 在 AWS EC2 服务器上不起作用