小编Man*_*non的帖子

acosl 不在 std 命名空间中?

根据 cppreference,该函数acosl应该在 std 命名空间中:https : //en.cppreference.com/w/cpp/numeric/math/acos

但是,使用 gcc(或 clang),以下代码无法编译:

#include <cmath>                                                                 

int main()                                                                       
{                                                                                
        long double var = std::acosl(4.0);                                      
        return 0;                                                                
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误消息:

gay@latitude-7490:~$ g++ -std=c++11 test.cpp
test.cpp: In function 'int main()':
test.cpp:5:26: error: 'acosl' is not a member of 'std'; did you mean 'acosh'?
    5 |  long double truc = std::acosl( (long double)4.0);
      |                          ^~~~~
      |                          acosh
Run Code Online (Sandbox Code Playgroud)

我错过了什么?我误读了 cppreference 吗?

c++ c++11

8
推荐指数
1
解决办法
113
查看次数

标签 统计

c++ ×1

c++11 ×1