我正在尝试将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中,我经历了构建库并链接包含和库文件夹的过程,似乎找不到针对此错误的任何东西。有什么想法吗?