I need to use the logarithmic integral function which is defined in the cmath
header. Unfortunately, I get an error: no member named 'expint' in namespace 'std'
when I try to compile it. To reproduce this error you just neet to try to compile this file.
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
int main()
{
std::cout << "Ei(0) = " << std::expint(0) << 'n'
<< "Ei(1) = " << std::expint(1) << 'n'
<< "Gompertz constant = " << -std::exp(1) * std::expint(-1) << 'n';
}
I tried to compile this file specifing the std library: c++17
, gnu++17
, gnu++20
, gnu++2b
and got the same error every time. I am on a M1 Mac with compiler
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
What is the problem? Why isn’t this function defined on cmath
?