Can't include <boost/multiprecision/mpfr.hpp>

510 views Asked by At

I have a simple program where I'd like to use <boost/multiprecision/mpfr.hpp>.

ex.xpp:

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

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

However, when I try to compile I get the following error:

... % 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)

I have both gmp and mpfr installed at /usr/local/include/, I can't really understand what could be the problem and I haven't find anyone in the internet with the same kind of problem, do you have any idea?

0

There are 0 answers