Compiling with several files
When your program becomes very large, it makes sense to
divide your source code into separate easily-manageable
.c files. The figure above demonstrates the compiling of a program made
up of two .c files and a single common.h file. The command is
as follows: cc green.c blue.cwhere both .c files are given to the compiler. Note that the first two steps taken in compiling the files are identical to the previous procedure for a single .c file, but the last step has an interesting twist: The two .o files are linked together at the Linker stage to create one executable program, a.out. |
Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu Last updated on Monday, February 05, 2001 Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility All rights reserved. |