Learn C Programming

Lesson 4 of 8 · The Preprocessor, Headers and Multi File Builds

Module 15 · The Preprocessor, Headers and Multi File Builds

Multi File Builds: Compiling, Linking and a First Makefile

ProReading

Kenji's game keeps its scores in three files: main.c, list.c and the header list.h. After every edit he types the same long gcc line, and GCC compiles every file again.

Checking what this lesson needs for you…

What is inside Multi File Builds: Compiling, Linking and a First Makefile

  1. Kenji's program in three files
  2. Two steps: compile each file, then link
  3. What an object file holds
  4. A file left out: undefined reference
  5. A first Makefile
  6. The timestamp experiment: what make rebuilds
  7. CMake writes the Makefile for you
  8. argc and argv: the words after the program's name