C++ VS2019社区中的Boost Multiprecision错误\u词法\u强制转换链接器错误
我正在尝试使用用于ccp_dec_float的Boost Multiprecision库,并且在尝试运行它时遇到了一些严重的问题。我一直收到一个链接器错误,该错误表示:C++ VS2019社区中的Boost Multiprecision错误\u词法\u强制转换链接器错误,c++,boost,linker-errors,multiprecision,C++,Boost,Linker Errors,Multiprecision,我正在尝试使用用于ccp_dec_float的Boost Multiprecision库,并且在尝试运行它时遇到了一些严重的问题。我一直收到一个链接器错误,该错误表示: Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "protected: virtual __thiscall boost::exception:
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
尝试从boost网站运行示例代码时会出现以下所有情况:
具体而言:
#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;
}
#包括
#包括
#包括
int main()
{
使用名称空间boost::multiprecision;
//在固定精度和全数字限制下的操作支持:
cpp_dec_float_100 b=2;
std::你能用std::numeric_limits
和cpp_dec_float_100
模板参数吗?一般来说,标准库只允许在float、double和long double上模板化std::numeric_limits
。@user14717无论我做什么都不一样。我已经在网络上尝试了很多不同的例子,现在仍然是获取完全相同的链接器错误。是否可以将std::numeric_limits
与cpp_dec_float_100
模板参数一起使用?通常,标准库只允许在float、double和long double上模板化std::numeric_limits
。@user14717不,无论我做什么,都是一样的。我已经尝试了很多不同的例子但仍然会得到完全相同的链接器错误。
#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;
}