【问题标题】:Errors using boost::math::ibeta使用 boost::math::ibeta 的错误
【发布时间】:2018-10-02 00:25:52
【问题描述】:

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

但是,下面的代码:

#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 是否在我可以确认存在的特定库中,还是只有标头?

【问题讨论】:

  • 干得好,请编辑问题中的“答案”部分并将其作为自我答案发布。这些东西对其他人有用。

标签: c++ visual-c++ boost


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 2014-12-08
    • 1970-01-01
    • 2012-05-24
    • 1970-01-01
    • 2011-09-28
    • 2021-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多