不能包含 <boost/multiprecision/mpfr.hpp>

问题描述

我有一个简单的程序,我想在其中使用 <boost/multiprecision/mpfr.hpp>

ex.xpp

#include <iostream>
#include <boost/multiprecision/mpfr.hpp>

int main() {
    std::cout << "Hello,World!" << std::endl;
    return 0;
}

但是,当我尝试编译时出现以下错误

... % g++ ex.cpp 

In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:9:
In file included from /usr/local/include/boost/multiprecision/number.hpp:25:
In file included from /usr/local/include/boost/multiprecision/detail/precision.hpp:9:
In file included from /usr/local/include/boost/multiprecision/traits/is_variable_precision.hpp:10:
/usr/local/include/boost/multiprecision/detail/number_base.hpp:38:9: warning: CAUTION: One or more C++11 features were found to be
      unavailable [-W#pragma-messages]
#pragma message("CAUTION: One or more C++11 features were found to be unavailable")
        ^
/usr/local/include/boost/multiprecision/detail/number_base.hpp:39:9: warning: CAUTION: Compiling Boost.Multiprecision in non-C++11
      or later conformance modes is Now deprecated and will be removed from march 2021. [-W#pragma-messages]
#pragma message("CAUTION: Compiling Boost.Multiprecision in non-C++11 or later conformance modes is Now deprecated and wil...
        ^
/usr/local/include/boost/multiprecision/detail/number_base.hpp:40:9: warning: CAUTION: Define
      BOOST_MP_disABLE_DEPRECATE_03_WARNING to suppress this message. [-W#pragma-messages]
#pragma message("CAUTION: Define BOOST_MP_disABLE_DEPRECATE_03_WARNING to suppress this message.")
        ^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:99:1: warning: CAUTION: One or more C++11 features were found to be unavailable
      [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: One or more C++11 features were found to be unavailable")
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:21:2: note: expanded from here
 message("CAUTION: One or more C++11 features were found to be unavailable")
 ^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:100:1: warning: CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is
      Now deprecated and will be removed from march 2021. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is Now deprecated and will be removed f...
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:24:2: note: expanded from here
 message("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is Now deprecated and will be removed from march 2021.")
 ^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:101:1: warning: CAUTION: Define BOOST_MATH_disABLE_DEPRECATED_03_WARNING to
      suppress this message. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: Define BOOST_MATH_disABLE_DEPRECATED_03_WARNING to suppress this message.")
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:27:2: note: expanded from here
 message("CAUTION: Define BOOST_MATH_disABLE_DEPRECATED_03_WARNING to suppress this message.")
 ^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:102:1: warning: CAUTION: This message was generated due to the define:
      BOOST_NO_CXX11_NOEXCEPT [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: This message was generated due to the define: " BOOST_MATH_CXX03_WARN_REASON)
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:30:2: note: expanded from here
 message("CAUTION: This message was generated due to the define: " "BOOST_NO_CXX11_NOEXCEPT")
 ^
7 warnings generated.
Undefined symbols for architecture x86_64:
  "_mpfr_free_cache",referenced from:
      boost::multiprecision::backends::detail::mpfr_cleanup<true>::initializer::~initializer() in ex-37ad80.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command Failed with exit code 1 (use -v to see invocation)

我在 gmp 安装了 mpfr/usr/local/include/,我真的不明白可能是什么问题,而且我在互联网上没有找到相同类型的人问题,你有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...