|
发表于 2006-6-23 10:11:39
|
显示全部楼层
Re: 怀疑我电脑上gcc出了问题!老是编译出错.烦请看一下
[quote:d0e1f62f8b="aaaaa007"]+++++++++++++++++++++++++++++++++++
[mao@MagicLinux ~]$ cd '/home/mao/练习文挡Qt/C++练习/string'
[mao@MagicLinux string]$ gcc -v
Reading specs from /usr/lib/gcc/i686-magic-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i686-magic-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-1mgc)
[mao@MagicLinux string]$ make
g++ -c -pipe -Wall -W -O2 -g -pipe -D_FORTIFY_SOURCE=2 -m32 -march=i686 -mcpu=i686 -mtune=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -I/usr/lib/qt-3.3/include -o main.o main.cpp
In file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from main.cpp:1:
./string:1: error: stray '\127' in program
./string:1: error: stray '\1' in program
./string:1: error: stray '\1' in program
./string:1: error: stray '\1' in program
./string:1: error: stray '\2' in program
./string:1: error: stray '\3' in program
./string:1: error: stray '\1' in program
./string:1: error: stray '\137' in program
./string:1: error: stray '\4' in program
./string:1: error: stray '\8' in program
./string:1: error: expected constructor, destructor, or type conversion before numeric constant
./string:1: error: expected `,' or `;' before numeric constant
./string:1: error: stray '\20' in program
./string:1: error: stray '\213' in program
./string:1: error: stray '\8' in program
./string:1: error: missing terminating ' character
./string:3: error: stray '\5' in program
./string:3: error: stray '\16' in program
./string:3: error: stray '\1' in program
./string:4: error: stray '\157' in program
./string:4: error: stray '\4' in program
./string:4: error: stray '\8' in program
./string:4: error: stray '\157' in program
./string:4: error: stray '\4' in program
./string:4: error: stray '\8' in program
./string:4: error: stray '\1' in program
./string:4: error: stray '\16' in program
./string:4: error: stray '\2' in program
./string:4: error: stray '\6' in program
./string:4: error: stray '\16' in program
./string:4: error: stray '\2' in program
./string:5: error: stray '\157' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\157' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\248' in program
./string:5: error: stray '\248' in program
./string:5: error: stray '\6' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\1' in program
./string:5: error: stray '\129' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\129' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\229' in program
./string:5: error: stray '\160' in program
./string:5: error: stray '\160' in program
./string:5: error: stray '\140' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\160' in program
./string:5: error: stray '\140' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\8' in program
./string:5: error: stray '\28' in program
./string:5: error: stray '\28' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\229' in program
./string:5: error: stray '\6' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\16' in program
./string:5: error: stray '\1' in program
./string:5: error: stray '\2' in program
./string:5: error: stray '\2' in program
./string:5: error: stray '\5' in program
./string:5: error: stray '\17' in program
./string:5: error: stray '\27' in program
./string:5: error: stray '\4' in program
./string:5: error: stray '\16' in program
./string:5: error: stray '\18' in program
./string:5: error: stray '\23' in program
./string:5: error: stray '\24' in program
./string:5: error: stray '\20' in program
./string:6: error: stray '\14' in program
./string:6: error: stray '\1' in program
./string:6: error: stray '\25' in program
./string:6: error: stray '\19' in program
./string:6: error: stray '\26' in program
./string:6: error: stray '\22' in program
./string:6: error: stray '\2' in program
./string:6: error: stray '\8' in program
./string:6: error: stray '\6' in program
./string:7: error: stray '\3' in program
./string:7: error: stray '\7' in program
./string:7: error: stray '\15' in program
./string:7: error: stray '\17' in program
./string:7: error: stray '\5' in program
./string:7: error: stray '\21' in program
./string:7: error: stray '\1' in program
./string:7: error: stray '\172' in program
./string:7: error: stray '\5' in program
./string:7: error: stray '\18' in program
./string:7: error: stray '\1' in program
./string:7: error: stray '\192' in program
./string:7: error: stray '\158' in program
./string:7: error: stray '\4' in program
./string:7: error: stray '\8' in program
./string:7: error: stray '\16' in program
./string:7: error: stray '\25' in program
./string:7: error: stray '\18' in program
./string:7: error: stray '\245' in program
./string:7: error: stray '\1' in program
./string:7: error: stray '\208' in program
./string:7: error: stray '\158' in program
./string:7: error: stray '\4' in program
./string:7: error: stray '\8' in program
./string:7: error: stray '\140' in program
./string:7: error: stray '\17' in program
./string:7: error: stray '\25' in program
./string:7: error: stray '\15' in program
./string:7: error: stray '\157' in program
./string:7: error: stray '\4' in program
./string:7: error: stray '\8' in program
./string:7: error: stray '\17' in program
./string:7: error: stray '\241' in program
./string:7: error: stray '\255' in program
./string:7: error: stray '\1' in program
./string:7: error: stray '\247' in program
./string:7: error: stray '\1' in program
./string:7: error: stray '\18' in program
./string:7: error: stray '\139' in program
./string:7: error: expected declaration before '}' tokenIn file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from main.cpp:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:40:1: unterminated #ifndef
In file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from main.cpp:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:40:1: unterminated #ifndef
In file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from main.cpp:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ios:39:1: unterminated #ifndef
In file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from main.cpp:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/ostream:40:1: unterminated #ifndef
In file included from main.cpp:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/iostream:39:1: unterminated #ifndef
make: *** [main.o] 错误 1
[mao@MagicLinux string]$
编译程序的时候无缘无故就出现这个问题。起先还以为是自己程序的问题,后来又编译以前正确的代码,同样出现类似上面红色字体的问题。
我是:
qmake -project
qmake -makefile
make
这样来的。之前的代码都没有出现问题过,所以我怀疑是自己电脑上的gcc的问题。有解决办法吗?
附用来调试的代码段:
[code:1]#include <iostream>
#include <string>
using namespace std;
int main () {
string numerics("0123456789");
string name("r2d2");
string::size_type pos =name.find_first_of( numerics);
cout <<pos<<"----"<<name[pos]<<endl;
return 0;
}[/code:1][/quote]
你的代码不够干净,
告诉你个办法,用kedit打开,粘贴拷贝到另外一个文件。 |
|