|
各位大哥,我今天是第一次使用gcc进行c++编程,只编了一个显示语句的程序,但在用g++调试的时候就出现了好多的错误,具体见下面代码,为什么呢?
[code:1]#include <iostream>
using namespace std;
int main()
{
cout<< "come up and c++ me some time.";
cout<<"\n";
return 0;
}
[/code:1]
编译结果:
[code:1][sun@localhost sun]$ g++ 1.cpp
1.cpp:1: parse error before `for'
1.cpp:1:36: missing terminating ' character
1.cpp:1:36: warning: character constant too long
1.cpp:2: parse error before `to'
1.cpp:3: parse error before `text'
1.cpp:3:36: missing terminating ' character
1.cpp:3:36: warning: character constant too long
In file included from /usr/include/c++/3.2.2/iosfwd:45,
from /usr/include/c++/3.2.2/ios:44,
from /usr/include/c++/3.2.2/ostream:45,
from /usr/include/c++/3.2.2/iostream:45,
from 1.cpp:5:
/usr/include/c++/3.2.2/bits/stringfwd.h:55: parse error before `<' token
/usr/include/c++/3.2.2/bits/stringfwd.h:58: confused by earlier errors, bailing
out
[/code:1] |
|