Monday, May 16, 2011

Use make file

Example:
if you have main.c as main program, file1.c and file2.c as sub program.
link it to main by creating makefile like this.

make file
main: main.o file1.o file2.o
gcc -o main.o file1.h
file1.o: file1.h
gcc -c file1.c
file2.o: file2.h
gcc -c file2.c
esc+wq+enter

then at command run run make