这是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);
我猜这个因为gcc版本导致的,还是需要声明引用。我页遇到了,但我没找到怎么引用呢
我也这样。。同求!!
被包涵的一些函数要先编译
要gcc max.o min.o hello.c
gcc版本问题吧 gcc -v