I've made a makefile and am trying to test it but am getting an error in 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

I thought that getting make * Error 1 meant that one of your components did not compile properly, however there weren't any error messages when I compiled it. How do I find out what the problem is?

share|improve this question
1  
While this doesn't have anything to do with your question, you might want to add the missing #includes to heap.c. – NPE Apr 9 '13 at 6:25
up vote 4 down vote accepted

./heap probably returned a non-zero exit code, which make is interpreting as an error. Make sure you are doing return 0; at the end of main.

share|improve this answer
    
This is correct, I wasn't returning 0 at the end of main. Thanks! – user2260199 Apr 9 '13 at 6:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.