我在 Linux 上使用 Visual Studio (1.31.1) 使用 g++ 编译器 (g++ (Ubuntu 8.2.0-7ubuntu1) 8.2.0) 进行 C++ 编程,并且在使用 bessel 函数时出现以下错误:
error: ‘cyl_bessel_j’ is not a member of ‘std’
这是我正在使用的代码,它是关于bessel页面的副本:
#include <cmath>
#include <iostream>
int main()
{
// spot check for n == 1
double x = 1.2345;
std::cout << "j_1(" << x << ") = " << std::cyl_bessel_j(1, x) << '\n';
// exact solution for j_1
std::cout << "(sin x)/x^2 - (cos x)/x = " << std::sin(x)/(x*x) - std::cos(x)/x << '\n';
}
VS 识别该功能,因为它是我编辑代码时建议的功能。我正在使用 ctrl+alt+N 运行代码。