如何在boost中使用digamma函数

how to use digamma function in boost

我不明白如何在程序中使用 digamma function of boost。任何例子,不胜感激。我加入了提升

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

但是函数调用 digamma(x),其中 x 是 double 给出了以下错误:

error: there are no arguments to ‘digamma’ that depend on a template parameter, so a declaration of ‘digamma’ must be available [-fpermissive]

举个例子: http://cpp.sh/7bdu

#include <boost/math/special_functions/digamma.hpp>
#include <iostream>
int main() {
    std::cout << boost::math::digamma(3.14) << "\n";
}

编辑: 编辑问题时出现错误消息。错误消息意味着编译器没有找到 digamma 的定义,因为你没有包含命名空间位 boost::math::.