c++ - 如何在C++中调用cmath库中的特殊函数?

标签 c++ identifier cmath

我正在尝试定义一个函数,要求我使用“关联拉盖尔多项式”。已列出here图书馆下。在 Visual Studio 代码中,智能感知将“assoc_laguerre()”预测为函数,因此它显然存在!

然而,在构建代码时,它会突出显示 assoc_laguerre() 函数并显示消息:“找不到标识符”。

任何帮助将不胜感激! 谢谢!

代码:

#include <iostream>
#include <vector>
#include <string>
#include<vector>
#include<fstream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<time.h>
#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include<math.h>
#include <stdio.h>
#include <cmath>
using namespace std;

//Function Definitons:
double a = 5.29177210903*pow(10,-11);
// Normalised Radial Component:
double Radial(double r,int n,int l,int Z){
    double rho, prefactor,R,L,M;
    rho = 2*r*Z/(n*a);
    R=pow(pow(rho/r,3)*tgamma(n-l)/(2*n*tgamma(n+l+1)),0.5)*exp(-rho/2)*pow(rho,l);
    L=R*assoc_laguerre(n-l-1,2*l+1,rho);

    M=L*R;
    return M;



}
int main()
{
    vector<string> msg {"End Process."};

    for (const string& word : msg)
    {
        cout << word << " ";
    }
  
}

最佳答案

您未在启用 C++ 2017 版本语言标准的情况下进行编译。启用它,这应该是可用的。您的代码使用 GCC 10.1 和 -std=c++17 进行编译;但如果我们使用 -std=c++14 则不然。

GodBolt

关于c++ - 如何在C++中调用cmath库中的特殊函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62625150/

相关文章:

c++ - 构造函数转换在 C++ 中如何工作?

php - 在 PHP 中生成唯一 ID

c++ - 使用 FLTK 时出现 cmath 错误

c++ - 仅使用库中的某些功能?

c++ - std::bind 是否应该与 boost::asio 兼容?

c++ - Boost phoenix 或 lambda 库问题:从 std::vector 中删除元素

python - Python变量是指针吗?否则,它们是什么?

visual-c++ - MSVC 上的 std::isfinite

c++ - 检查来自不同类的两个 Rect 之间的碰撞

identifier - 是否有用于城市识别的 ISO 标准?