大神秀操作

本文记录了一次解决GCC4.7编译器出现编译错误的经历,通过更换使用GCC4.8.5成功编译并运行C++程序,解决了因编译器损坏导致的无法编译问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在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

   




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值