|
楼主 |
发表于 2006-8-13 16:01:30
|
显示全部楼层
好像还是有点问题:)
下面是输入的cpp文件,文件名是NONAME00,是我在win下面的Turbo C++3.0写的
[root@MagicLinux2 C++]# g++ -o NONAME00 NONAME00.CPP
In file included from /usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:31,
from NONAME00.CPP:1:
/usr/lib/gcc/i686-magic-linux/3.4.4/../../../../include/c++/3.4.4/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.
NONAME00.CPP:7: error: `main' must return `int'
不知道为什么说有错,是不是Linux下的语法和win下面的语法要求不同?
源代码是:
#include <iostream.h>
int max(int a,int b);
int max(int a,int b,int c);
int max(int a,int b,int c,int d);
void main()
{
cout<<max(2,4)<<endl;
cout<<max(4,5,6)<<endl;
cout<<max(2,4,5,6)<<endl;
}
int max(int a,int b)
{
return a>b?a:b;
}
int max(int a,int b,int c)
{
int t=max(a,b);
return max(t,c);
}
int max(int a,int b,int c,int d)
{
int t1=max(a,b);
int t2=max(t1,c);
return max(t2,d);
}
在win下面编译是成功的 |
|