【发布时间】:2013-04-09 06:22:06
【问题描述】:
我制作了一个 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 * 错误 1 意味着您的组件之一没有正确编译,但是当我编译它时没有任何错误消息。如何找出问题所在?
【问题讨论】:
-
虽然这与您的问题无关,但您可能希望将缺少的
#includes 添加到heap.c。