Find   


An Affiliate of AIHorizon




This tip submitted by cjediknight on 2005-08-05 05:19:01. It has been viewed 30895 times.
Rating of 3.1818 with 66 votes

Use makefile




When writting a large program, always use a multi-source file compilation.
do this by creating a 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.

$vi makefile
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
$make




More tips


Add a tip!



-----
Interested in advertising with us?
Please read our privacy policy.
Copyright © 1997-2005 Cprogramming.com. All rights reserved.