警告:返回类型默认为'诠释'[-Wreturn型] [英] warning: return type defaults to ‘int’ [-Wreturn-type]
本文介绍了警告:返回类型默认为'诠释'[-Wreturn型]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是谁开始学习C Linux用户,我试图编译这个来源,我输入:
的#include<&stdio.h中GT;
主要()
{
浮C,D;
C = 10215.3;
D = C / 3;
的printf(%3.2F \\ n,D);
返回0;
}
它使用一个makefile,我写编译如下:
CC -Wall -g -o printf.c的printf
但我发现了这样的警告:
printf.c:2:1:警告:返回类型默认为'诠释'[-Wreturn型]
块引用>它编译code和我得到需要的结果,但我想知道这是什么意思
解决方案的main()
应
INT的main()
在C89中,默认返回类型假定为
INT
,这就是为什么它的工作原理。I'm a Linux user who started learning C and I'm trying to compile this source that I typed:
#include <stdio.h> main() { float c,d; c = 10215.3; d = c / 3; printf("%3.2f\n",d); return 0; }
It compiled with this using a makefile that I wrote:
cc -Wall -g printf.c -o printf
but I'm getting this warning:
printf.c:2:1: warning: return type defaults to ‘int’ [-Wreturn-type]
it compiles the code and I get the desired output but I want to understand what this means
解决方案main()
should be
int main()
In C89, the default return type is assumed to be
int
, that's why it works.这篇关于警告:返回类型默认为'诠释'[-Wreturn型]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文