1

我正在尝试将 Boost Multiprecision 库用于 ccp_dec_float 并且在尝试运行它时遇到了一些严重的问题。我一直收到一个链接器错误,上面写着:

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   

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

所有这一切都在尝试从 boost 网站运行示例代码时:https ://www.boost.org/doc/libs/1_70_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html 。

具体来说:

 #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;
 }

我已经完成了在 vs 2019 中构建库并链接包含和库文件夹的过程,似乎找不到任何特定于此错误的内容。有任何想法吗?

4

0 回答 0