Skip to content
Learn Netverks

Lesson

Step 25/36 69% through track

compilation-process

The compilation process

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches The compilation process: the syntax, patterns, and safety habits you need before advancing in C.

Teams still ship The compilation process in C codebases—skipping it leaves gaps in debugging and code reviews.

You will apply The compilation process in contexts like: Kernels, drivers, embedded devices, and performance libraries used by other languages.

Write C in main.c with int main(), click Run on server—the dev runner compiles with cc/gcc -std=c11 and runs the binary; read stderr for compile and linker errors (LEARNING_RUNNER_ENABLED=true).

When you can explain the previous lesson's ideas without copying starter code.

Building a C program is a pipeline: preprocess → compile → assemble → link. Understanding stages helps debug weird errors.

Stages

  1. Preprocessor — expands #include and macros
  2. Compiler — translates C to assembly
  3. Assembler — produces machine code object files
  4. Linker — combines objects and libc into an executable

Useful gcc flags

  • -std=c11 — language standard
  • -Wall -Wextra — warnings
  • -g — debug symbols for gdb
  • -O2 — optimizations for release builds

Important interview questions and answers

  1. Q: Undefined reference error?
    A: Linker cannot find a function definition—missing source file or library.
  2. Q: Multiple definition error?
    A: Same global symbol defined in more than one translation unit.

Self-check

  1. Which stage handles #include?
  2. What flag adds debug symbols?

Tip: Run gcc -E to see preprocessed output when macro or include issues confuse you.

Interview prep

Undefined reference?

Linker error—function declared but not defined, or required library not linked.

Preprocessor stage?

Handles #include, #define, and conditional compilation before the compiler sees C code.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Preprocessor stage?
  • Linker role?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump