gcc智能编译失败说我未申明
这是hello.c文件源码:
#include <stdio.h>
//#include "max.c"
//#include "min.c"
int main()
{
int a1=33;
int a2=21;
int maxNum=max(a1,a2);
int minNum=min(a1,a2);
printf("the max value is %d\nthe min value is %d\n",maxNum,minNum);
return 0;
}
这种情况下输入命令:gcc hello.c max.o min.o 然后回车为什么会:
hello.c: In function ‘main’:
hello.c:9:16: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration]
int maxNum=max(a1,a2);
^
hello.c:10:16: warning: implicit declaration of function ‘min’ [-Wimplicit-function-declaration]
int minNum=min(a1,a2);