为什么当我仅#include ] >>> [ 我将gcc升级到5.4,除了math.h似乎没问题 当我写如下hello.cpp时: #include<math.h> int main(){return 0;} 然后我使用gcc 5.4,g ++ 5.4构建上述cpp g++ hello.cpp 发生错误 In file included from /usr/include/math.h:70:0, from main.cpp:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:63:16: error: expected constructor, destructor, or type conversion before ‘(’ token __MATHCALL_VEC (cos,, (_Mdouble_ __x)); ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:65:16: error: expected constructor, destructor, or type conversion before ‘(’ token __MATHCALL_VEC (sin,, (_Mdouble_ __x)); ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:22: error: ‘sincos’ has not been declared __MATHDECL_VEC (void,sincos,, ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:29: error: expected identifier before ‘,’ token __MATHDECL_VEC (void,sincos,, ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:82:3: error: expected identifier before ‘(’ token 我将gcc升级到5.4,除了math.h之外,似乎还可以,当我像下面这样编写hello.cpp时:#include int main(){return 0;}然后我用gcc 5.4构建了上述cpp ,g ++ 5.4 g ++ ... ] >> 这个问题对我来说是不可复制的。 g++ hello.cpp -ansi -Wall -pedantic 编译无误。并运行: Valgrind在运行时未报告任何错误。 ==100412== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 海报的安装有问题。另外,正如其他人所说,升级gcc。

问题描述 投票:0回答:1
我将gcc升级到5.4,除了math.h似乎没问题

当我写如下hello.cpp时:

#include<math.h> int main(){return 0;}

然后我使用gcc 5.4,g ++ 5.4构建上述cpp

g++ hello.cpp

发生错误

In file included from /usr/include/math.h:70:0, from main.cpp:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:63:16: error: expected constructor, destructor, or type conversion before ‘(’ token __MATHCALL_VEC (cos,, (_Mdouble_ __x)); ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:65:16: error: expected constructor, destructor, or type conversion before ‘(’ token __MATHCALL_VEC (sin,, (_Mdouble_ __x)); ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:22: error: ‘sincos’ has not been declared __MATHDECL_VEC (void,sincos,, ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:29: error: expected identifier before ‘,’ token __MATHDECL_VEC (void,sincos,, ^ /usr/include/x86_64-linux-gnu/bits/mathcalls.h:82:3: error: expected identifier before ‘(’ token

我将gcc升级到5.4,除了math.h之外,似乎还可以,当我像下面这样编写hello.cpp时:#include 

int main(){return 0;}然后我用gcc 5.4构建了上述cpp ,g ++ 5.4 g ++ ...

c++11 ubuntu-16.04 glibc gcc5
1个回答
0
投票
这个问题对我来说是不可复制的。

g++ hello.cpp -ansi -Wall -pedantic

编译无误。并运行:
© www.soinside.com 2019 - 2024. All rights reserved.