c++ - 使用 boost::math::ibeta 时出错

标签 c++ visual-c++ boost

我已经安装了 boost_1_67_0,并使用了 lambda.hpp 中的函数以及正则表达式库来确认仅 header 函数和基于库的函数是否正常工作。

但是,下面的代码:

#include <boost/math/special_functions/gamma.hpp>
int main(int argc, char * argv[]) {
    boost::math::ibeta((double)5, (double)1, (double)0.5);
}

抛出错误(Visual Studio Community 2017,15.5.2):

LNK2019 unresolved external symbol "double __cdecl boost::math::ibeta<double,double,double>(double,double,double)" (??$ibeta@NNN@math@boost@@YANNNN@Z) referenced in function _main ProjectName C:\PathToProject\ProjectName\main.obj   1   
LNK1120 1 unresolved externals

我尝试重新安装 boost,重新创建项目,在 x86 和 x64 之间切换(以及调试/发布),并使​​用 boost_1_66_0。还有其他想法我做错了什么吗?我可以确认的特定库中的 ibeta 是否存在,或者它是否仅包含 header ?

最佳答案

我使用了错误的包含 - 我应该使用 beta.hpp 而不是 gamma.hpp。此错误的来源是 boost 文档中列出的不正确包含 here . ibeta 的正确包含是

#include <boost/math/special_functions/beta.hpp>

ibeta 的正确文档是 here .上一个链接是针对旧版本的 boost(如果您 [我] 当前搜索“boost ibeta”,Google 会链接到该链接)。

关于c++ - 使用 boost::math::ibeta 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49955989/

相关文章:

c++ - 用于键盘异步输入的库

c++ - 并行化动态数组

c++ - VC++ : Pass multiple arrays between functions

c++ - 重载模板函数的 std 绑定(bind)

c++ - Boost:如何设置程序优先级?

c++ - 使用 RapidXML 和 C++ 从 XML 文件构建树

c++ - MFC:如何绘制带有换行和垂直居中的文本?

c++ - 删除除某些位置以外的特定位置的元素

c++ - 在 std::map 中插入一个 boost::unique_ptr

c++ - 在 Boost multi_array 中进行维度排列