請教下各位大神,這是什么原因造成的?
代碼(code):
#include <stdio.h>
int main()
{
int a1=32;
int a2=51;
int maxNum=max(a1,a2);
printf("the max value is %d",maxNum);
return 0;
}
錯誤報(bào)告(error report):
trugle@strugle-virtual-machine:~/workspace/les1/les2$ gcc max.c hello.c o- main.out
hello.c: In function ‘main’:
hello.c:8:20: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration]
? ? 8 |? ? ? ? ?int maxNum=max(a1,a2);
? ? ? |? ? ? ? ? ? ? ? ? ? ^~~
gcc: error: -E or -x required when input is from standard input
2022-11-25
2022-08-12
你的max函數(shù)沒有聲明,可以選擇在main函數(shù)之前把max寫上,或者在頭文件里引用max.c或者編譯后的max.h