1

I am trying to use the Boost Multiprecision library for the ccp_dec_float and am having some serious troubles with trying to run it. I am consistently getting a linker error that says:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "protected: virtual __thiscall boost::exception::~exception(void)" (??1exception@boost@@MAE@XZ) referenced in function "public: virtual __thiscall boost::exception_detail::error_info_injector<class boost::bad_lexical_cast>::~error_info_injector<class boost::bad_lexical_cast>(void)" (??1?$error_info_injector@Vbad_lexical_cast@boost@@@exception_detail@boost@@UAE@XZ)   test    C:\Users\MCDZ\Desktop\C++\test\test\test.obj    1   

and

Severity    Code    Description Project File    Line    Suppression State
Error   LNK1120 1 unresolved externals  test    C:\Users\MCDZ\Desktop\C++\test\Debug\test.exe   1   

All this when trying to run example code from the boost website: https://www.boost.org/doc/libs/1_70_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html.

specifically:

 #include <boost/multiprecision/cpp_dec_float.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <iostream>

 int main()
 {
   using namespace boost::multiprecision; 

    // Operations at fixed precision and full numeric_limits support:
    cpp_dec_float_100 b = 2;
    std::cout << std::numeric_limits<cpp_dec_float_100>::digits << std::endl;
    // Note that digits10 is the same as digits, since we're base 10! :
    std::cout << std::numeric_limits<cpp_dec_float_100>::digits10 << std::endl;
    // We can use any C++ std lib function, lets print all the digits as well:
    std::cout << std::setprecision(std::numeric_limits<cpp_dec_float_100>::max_digits10)
       << log(b) << std::endl; // print log(2)
    // We can also use any function from Boost.Math:
    std::cout << boost::math::tgamma(b) << std::endl;
    // These even work when the argument is an expression template:
    std::cout << boost::math::tgamma(b * b) << std::endl;
    // And since we have an extended exponent range we can generate some really large 
    // numbers here (4.0238726007709377354370243e+2564):
    std::cout << boost::math::tgamma(cpp_dec_float_100(1000)) << std::endl;
    return 0;
 }

I have gone through building the libraries and linking the includes and library folders in vs 2019 and cannot seem to find anything specific to this error. Any ideas?

mcdz89
  • 47
  • 1
  • 8
  • Can you use `std::numeric_limits` with `cpp_dec_float_100` template arguments? Generally the standard library only allows templating `std::numeric_limits` on float, double and long double. – user14717 Oct 07 '19 at 15:28
  • @user14717 No its the same no matter what I do. I have tried so many different examples for all over the web and still get the exact same linker error. – mcdz89 Oct 07 '19 at 16:27

0 Answers0