2013-04-09 85 views
0

我做了一個makefile,我試圖測試,但我在化妝得到一個錯誤:品牌:*** []錯誤1

austins-macbook:work4 staffmember$ make new 
rm -f main.o heap.o heap 
gcc -Wall -O2 -c -o main.o main.c 
gcc -Wall -O2 -c -o heap.o heap.c 
heap.c: In function ‘createHeap’: 
heap.c:6: warning: implicit declaration of function ‘malloc’ 
heap.c:6: warning: incompatible implicit declaration of built-in function ‘malloc’ 
heap.c:8: warning: implicit declaration of function ‘exit’ 
heap.c:8: warning: incompatible implicit declaration of built-in function ‘exit’ 
gcc -Wall -O2 -o heap main.o heap.o 
austins-macbook:work4 staffmember$ make test 
./heap 
make: *** [test] Error 1 

我認爲越來越讓*錯誤1的意思你的某個組件沒有正確編譯,但是編譯它時沒有任何錯誤消息。我如何找出問題所在?

+1

雖然這與您的問題沒有任何關係,但您可能希望將缺少的'#include'添加到'heap.c'。 – NPE 2013-04-09 06:25:15

回答

4

./heap可能返回了一個非零退出代碼,其中make被解釋爲錯誤。請確保您在main的末尾執行return 0;

+0

這是正確的,我在main的結尾沒有返回0。謝謝! – user2260199 2013-04-09 06:27:07

相關問題