Skip to content
UPEEC

C Compilation Process

Source code goes through preprocessing, compilation, assembly and linking to become an executable.

Easy
Comments 0
  1. Preprocessing — expands #include and #define, removes comments (gcc -E).
  2. Compilation — C → assembly for the target CPU (gcc -S).
  3. Assembly — assembly → machine code object file .o (gcc -c).
  4. Linking — joins object files and libraries into one executable, resolving function addresses.

A "undefined reference" error comes from the linker (a function was declared but never defined), while syntax errors come from the compiler.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.