Build, Debug, and Test
Build, Debug, and Test
Compile with warnings, debug with symbols, and use sanitizers to catch bugs early.
Build, Debug, and Test
Compile with warnings, debug with symbols, and use sanitizers to catch bugs early.
For local work, start with strong warnings.
-std=c++23 -Wall -Wextra -Wpedantic
Add debug symbols and disable heavy optimization while diagnosing problems.
-g -O0
-fsanitize=address,undefined
These catch memory and undefined-behavior bugs that might otherwise look random.
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build
ctest --test-dir build --output-on-failure
This is the default workflow many modern C++ projects settle on, even when the codebase grows.
Run them in dedicated builds instead of combining every tool in one configuration.
When you find a bug, record the failing input, compiler, build flags, and exact observed output. That information turns debugging from guessing into engineering.