[prev] 37 [next]

Multi-module C Programs and Makefiles

All large systems written in C ...
  • are built as a large number of .c files
  • which are compiled separately
  • and then combined to form an executable
Small (tiny) example:

$ gcc -c Stack.c              # produces Stack.o
$ gcc -c main.c               # produces main.o
$ gcc -o main main.o Stack.o  # links Stack.o + main.o