[问题]g++的问题

软件和网站开发以及相关技术探讨
回复
meladet
帖子: 18
注册时间: 2006-08-27 19:32

[问题]g++的问题

#1

帖子 meladet » 2006-09-10 13:05

我写一个简单的 C++程序。可是编译的时候出问题。 是不是还有什么东西没有配置好?请帮忙看看。谢过了。
程序代码:
#include <iostream.h>

int main()
{
cout<<"hello world !"<<endl;
return 0;

编译错误:
In file included from /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/backward/iostream.h:31,
from hello.cpp:1:
/usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
hello.cpp:7: 错误: 程序中有游离的 ‘\239’
hello.cpp:7: 错误: 程序中有游离的 ‘\189’
hello.cpp:7: 错误: 程序中有游离的 ‘\157’
hello.cpp: In function ‘int main()’:
hello.cpp:6: 错误: expected `}' at end of input
pho
帖子: 37
注册时间: 2006-04-24 13:26

#2

帖子 pho » 2006-09-10 13:51

最后一个大括号是中文下的括号,换成英文的才行
头像
fiftymetre
帖子: 37
注册时间: 2006-09-29 15:06

#3

帖子 fiftymetre » 2006-09-30 13:54

#include <iostream>

int main()
{
cout<<"hello world !"<<endl;
return 0;
}
ubuntu_jonathan
帖子: 8
注册时间: 2006-10-03 23:31

#4

帖子 ubuntu_jonathan » 2006-10-04 0:31

应该是这样的:
#include <iostream>
int main()
{
std::cout << "hello world !" << std::endl;
return 0;
}
这个是名字空间问题
dbzhang800
帖子: 3182
注册时间: 2006-03-10 15:10
来自: xi'an China
联系:

#5

帖子 dbzhang800 » 2006-10-04 9:10

呵呵,是最后一个大括号的问题
回复