Getting started
This part puts a C++ toolchain on the machine and takes a program through it: the packages on Linux and Windows, an editor with a debugger, the first compile and link with the program read line by line, and the warnings the build should print. Headers and separate compilation follow, then the fundamental types, the operators and the control flow of if, switch and the loops. The part ends with functions and with main taking its arguments from the shell.
001
Install a C++ toolchain on Linux
g++ from apk or apt, version macros, the default standard, the first build and its two usual errors
Open
002
Install a C++ toolchain on Windows
MSYS2 and MinGW-w64, Visual Studio Build Tools, PATH, and the same source built with both compilers
Open
003
Set up an editor, a compiler and GDB
the edit-compile-run loop, compiler diagnostics, GDB in batch mode and compile_commands.json for an editor
Open
004
Your first C++ program
hello.cpp line by line, preprocessing, compiling, linking, the exit status and a missing semicolon
Open
005
Read compiler warnings
-Wall, -Wextra, -Wpedantic, unused names, signed and unsigned comparisons, uninitialised values and -Werror
Open
006
Headers, object files and the linker
declare in a header, define in a .cpp, compile to .o, link, and the errors that an ODR violation prints
Open
007
Variables and fundamental types
int, unsigned, double, char and bool, sizeof, numeric limits, brace initialisation and narrowing errors
Open
008
Operators and expressions
arithmetic, integer division, comparison, short-circuit logic, bitwise masks and operator precedence
Open
009
Conditions and loops
if and else, switch with fallthrough, for, while, do-while, range-for and break and continue
Open
010
Functions
declarations, definitions, parameters, return values, early return and main with argc and argv
Open