0

我制作了一个 makefile 并正在尝试对其进行测试,但在 make 中出现错误:

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

我认为获取 make * Error 1 意味着您的组件之一没有正确编译,但是当我编译它时没有任何错误消息。我如何找出问题所在?

4

1 回答 1

4

./heap可能返回一个非零退出代码,它make被解释为一个错误。确保您return 0;main.

于 2013-04-09T06:23:05.047 回答