Stage 1 · Lesson 1 of 8
Compiling, linking and warnings
C++ source code becomes a program in two steps: . The turns each .cpp file into an , a piece of . The linker then joins those pieces and any libraries into one executable you can run.
g++ -std=c++20 -Wall -Wextra main.cpp -o app does both steps, and ./app runs the result. clang++ and MSVC work the same way. Turn warnings on from day one, because they catch real bugs, such as unused results and comparisons between signed and unsigned numbers.
Learn to tell the two error types apart. A points at a line of your code. A linker error such as "undefined reference" means something was declared but never defined, or never compiled in. Read the first error, not the last.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with
- CourseFreeLearnCpp.com
LearnCpp.com · Beginner
Free, current and careful: chapters 0 to 16 take you from setup to references and std::vector