聲明max.c的問(wèn)題
main 函數(shù)中不聲明max.c 為什么gcc max.c hello.c也會(huì)報(bào)錯(cuò)In function 'main',implicit declaration of function 'max main函數(shù)中聲明了max.c 編譯只用gcc hello.c 就行了 不懂求解'
main 函數(shù)中不聲明max.c 為什么gcc max.c hello.c也會(huì)報(bào)錯(cuò)In function 'main',implicit declaration of function 'max main函數(shù)中聲明了max.c 編譯只用gcc hello.c 就行了 不懂求解'
2016-09-12
舉報(bào)
2016-09-12
因?yàn)樵趆ello.c中有調(diào)用max.c,所以如果在hello.c中不對(duì)max函數(shù)進(jìn)行聲明的話,那么在max函數(shù)展開時(shí)就不知道去哪里找了。相反,如果使用“”聲明后,系統(tǒng)默認(rèn)會(huì)在同一文件夾下搜索“”包含的頭文件,在調(diào)用時(shí)就能自動(dòng)搜索展開,所以不會(huì)報(bào)錯(cuò)了。