c - Makefile Executable Error -
i have following makefile:
all: test.c test1.c gcc -o test test.c -lm gcc -o test1 test1.c ./test 1000 input.txt
i getting error ./test 1000 input.txt make: *** [run] error 255
. makefile correct?
./test 1000 input.txt make: *** [run] error 255
this doesn't mean wrong makefile. means ./test
program ran exited status 255.
you haven't showed test.c
, i'm assuming didn't write return 255;
. since exit status 8 bits, it's possible (incorrectly) wrote return -1
. it's possible (incorrectly) omitted return statement main
leads undefined behavior, , -1 happens in return value register (eax
on x86).
you should always enable compiler warnings. force correct them, these warnings (which indicate broken code) should cause compilation fail well.
cflags = -wall -wextra -werror test: test.c $(cc) $(cflags) -o $@ $^
Comments
Post a Comment