在codeblocks上瞎鼓捣了几天,把gcc4.7编译器搞坏了,请教大神 ,看大神show:
:~/Desktop/cpp$ gedit test.cpp
~/Desktop/cpp$
g++ test.cpp
In file included from /usr/include/c++/4.7/ios:40:0,
from /usr/include/c++/4.7/ostream:40,
from /usr/include/c++/4.7/iostream:40,
from test.cpp:1:
/usr/include/c++/4.7/exception:121:4: error: stray ‘@’ in program
In file included from /usr/include/c++/4.7/ios:40:0,
from /usr/include/c++/4.7/ostream:40,
from /usr/include/c++/4.7/iostream:40,
from test.cpp:1:
/usr/include/c++/4.7/exception:1:2: error: ‘Exception’ does not name a type
/usr/include/c++/4.7/exception:9:24: error: ‘you’ does not name a type
/usr/include/c++/4.7/exception:11:32: error: ‘either’ does not name a type
/usr/include/c++/4.7/exception:15:28: error: ‘without’ does not name a type
/usr/include/c++/4.7/exception:25:2: error: ‘see’ does not name a type
In file included from /usr/include/c++/4.7/ios:40:0,
from /usr/include/c++/4.7/ostream:40,
from /usr/include/c++/4.7/iostream:40,
from test.cpp:1:
/usr/include/c++/4.7/exception:37:37: error: expected declaration before end of line
~/Desktop/cpp$ g++ --version
~/Desktop/cpp$ g++-4. --version
g++-4.7 g++-4.8
~/Desktop/cpp$ g++-4.8 --version
g++-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
~/Desktop/cpp$ g++-4.8 test.cpp
~/Desktop/cpp$ ls
a.out evaluate_object.cpp mail.h test.cpp
~/Desktop/cpp$ ./main
bash: ./main: No such file or directory
~/Desktop/cpp$ ./a.out
test
大神用另一个gcc4.8.5编译运行的。
下面模仿一个:
~/Desktop/cpp$ gedit ff.cpp
~/Desktop/cpp$ g++-4.8 -O3 -DNDEBUG -o main ff.cpp
~/Desktop/cpp$ ls
a.out evaluate_object.cpp ff.cpp ff.cpp~ mail.h main test.cpp test.cpp~
~/Desktop/cpp$ ./main
testhhhh