Quando tento compilar qualquer programa c++
usando g++
, recebo o seguinte erro, o rastreamento da pilha é realmente longo, isso é apenas uma amostra:
...........
/usr/include/x86_64-linux-gnu/bits/byteswap.h:47:2: error: stray ‘0’ in program
/usr/include/x86_64-linux-gnu/bits/byteswap.h:47:2: error: stray ‘0’ in program
/usr/include/x86_64-linux-gnu/bits/byteswap.h:47:2: error: stray ‘0’ in program
/usr/include/x86_64-linux-gnu/bits/byteswap.h:47:2: error: stray ‘’ in program
/usr/include/x86_64-linux-gnu/bits/byteswap.h:47:2: error: stray ‘0’ in program
In file included from /usr/include/endian.h:60:0,
from /usr/include/ctype.h:39,
from /usr/include/c++/4.8/cctype:42,
from /usr/include/c++/4.8/bits/localefwd.h:42,
from /usr/include/c++/4.8/ios:41,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from post_test_5.cpp:1:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:1:1: error: expected unqualified-id before numeric constant
/usr/include/x86_64-linux-gnu/bits/byteswap.h:11:2: error: expected unqualified-id before numeric constant
In file included from /usr/include/endian.h:60:0,
from /usr/include/ctype.h:39,
from /usr/include/c++/4.8/cctype:42,
from /usr/include/c++/4.8/bits/localefwd.h:42,
from /usr/include/c++/4.8/ios:41,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from post_test_5.cpp:1:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:26:31: error: expected declaration before ‘}’ token
E o código de exemplo é post_test_5.cpp
:
#include<iostream>
int main() {
std::cout << "Hello World" << std::endl;
return 0;
}
E eu tento executá-lo como:
g++ -c post_test_5.cpp
As minhas versões gcc
e ubuntu são:
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
kirill@kirill-ThinkPad-X140e:~/CPlusPlusStuff/PostTest$ lsb_release -d
Description: Ubuntu 14.04 LTS
No entanto, quando eu uso o comando gcc
para compilar o arquivo .c
, tudo funciona corretamente.
O que poderia estar causando isso?