LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 647|回复: 1

为什么编译不了

[复制链接]
发表于 2004-11-21 17:39:21 | 显示全部楼层 |阅读模式
这一个程序:
#include<iostream.h>
int Abc(int a, int b, int c)
{
  return a+b+b*c+(a+b-c)/(a+b)+4;
}
void main(void)
{
   cout << Abc(2,3,4) << endl;
}

我输入命令 g++ -o abc abc1.cpp
但显示的结果是

In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,                 from abc1.cpp:1:/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes atleast 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 <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.abc1.cpp:9: `main' must return `int'
发表于 2004-11-21 20:30:07 | 显示全部楼层
什么年代了,还在写这种老程序,根据C++的标准,头文件不用加.h后缀。同时,要声明using namespace std。
找本介绍新标准C++的书好好看看。不然会后悔的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表