I am new to Linux programming I tried to compile a simple test construction. But I\'m getting an error when compiling. Adding inc.c as well (in the app: line) doesn\'t work.
You need to compile inc.c as well. A suitable approach (better scalable to larger applications) would be to split the Makefile up into different targets. The idea is: one target for every object file, then one target for the final binary. For compiling the object files, use the -c argument.
app: main.o inc.o
cc -o app main.o inc.o
main.o: main.c inc.h
cc -c main.c
inc.o: inc.c inc.h
cc -c inc.c