Skip to content
Learn Netverks

Lesson

Step 31/36 86% through track

multi-file-projects

Multi-file projects

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

This lesson

This lesson teaches Multi-file projects: the syntax, patterns, and safety habits you need before advancing in C.

Teams still ship Multi-file projects in C codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Multi-file projects 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 pointers, structs, and basic control flow from intermediate lessons are familiar.

Real C projects split code across many .c files with headers and build with Make, CMake, or Meson. The playground stays single-file, but the layout below is what you use locally.

Typical layout

project/
  include/mylib.h
  src/mylib.c
  src/main.c
  Makefile

Build example

CC=gcc
CFLAGS=-std=c11 -Wall -g
main: main.o mylib.o
    $(CC) -o main main.o mylib.o

Important interview questions and answers

  1. Q: Why static functions?
    A: Limit symbol visibility to one translation unit—avoids linker name collisions.
  2. Q: CMake vs Make?
    A: CMake generates build files cross-platform; Make is simpler for small projects.

Self-check

  1. What tool invokes the linker in a Makefile?
  2. Where do public declarations usually live?

Interview prep

static function?

Internal linkage—symbol visible only within its translation unit, avoiding name collisions.

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

  • Makefile minimal?
  • extern keyword?

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