[prev] [index] [next]

Building Large Programs

Building the example program is relatively simple:

$ gcc -c -g -Wall world.c
$ gcc -c -g -Wall graphics.c
$ gcc -c -g -Wall main.c
$ gcc -Wall -o game main.o world.o graphics.o

For larger systems, building is either

  • inefficient   (recompile everything after any change)
  • error-prone   (recompile just what's changed + dependents)
    • module relationships easy to overlook
      (e.g. graphics.c depends on a typedef in world.h)
    • you may not know when a module changes
      (e.g. you work on graphics.c, others work on world.c)