почему это ошибка компиляции, когда я только #include - PullRequest
0 голосов
/ 21 марта 2020

я обновляю g cc до 5.4, кажется, что все в порядке, кроме math.h

, когда я пишу привет. cpp как показано ниже:

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

затем я компилирую выше cpp с g cc 5.4, g ++ 5.4

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

при понижении до g cc 4.8, 4.9, эта проблема все еще случается

Ответы [ 2 ]

1 голос
/ 21 марта 2020

Этот вопрос для меня не воспроизводим.

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

Компилируется без ошибок. И запускает:

Valgrind не сообщает об ошибках при запуске.

==100412== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Что-то не так с установкой плаката. Также, как говорили другие, обновите g cc.

0 голосов
/ 22 марта 2020

Я нашел решение:

apt-get install linux-libc-dev
...