TeqStudy ยท C++ Track ยท Phase 12

Tooling

CMake for multi-file builds, real debugging with breakpoints, version control with git, compiler warnings, static analysis, and unit testing โ€” the professional workflow around the language itself.

๐Ÿงฐ ๐Ÿ—๏ธ ๐Ÿ” ๐Ÿ“š ๐Ÿ
Course Progress
0%
MODULE 01

๐Ÿงฐ Why Tooling Matters โ€” Beyond the Language Itself

You've compiled every program in this entire roadmap with a single g++ command. A real, professional, job-ready workflow needs more โ€” this phase closes that specific gap.

๐ŸŽฏ What "Job-Ready" Genuinely Requires Beyond Syntax

Knowing C++ syntax and knowing how to work on a real C++ project are genuinely different skills. Professional projects have many source files, need a repeatable way to build them, get investigated with real debugging tools rather than scattered std::cout statements, and are tracked with version control so a team can collaborate without overwriting each other's work.

๐Ÿงฐ What This Phase Actually Covers
ToolSolves
CMake (Module 1)Building a project with more than one file, reliably, on any machine
A debugger (Module 2)Investigating what a program is ACTUALLY doing, step by step, rather than guessing
Git (Module 3)Tracking every change to your code over time, and collaborating without conflicts
Static analysis (Module 5)Catching real bugs before the program ever runs
Unit testing (Module 6)Proving your code genuinely works, automatically, every time you change it
๐Ÿ’ก
If you've already looked at this platform's Terminal Mastery or CLion GUI Development coursesSome of the terminal fundamentals and IDE-specific workflow from those courses will feel genuinely familiar here โ€” this phase applies those same skills specifically to a real C++ project's needs.
๐Ÿง  Quick Check
What is the core gap this phase is designed to close?
MODULE 02

๐Ÿ—๏ธ CMake โ€” Build Systems Basics

The Pre-Course's g++ main.cpp -o program command genuinely doesn't scale once a project has multiple source files with dependencies between them.

๐Ÿ˜– Why a Single Compile Command Stops Working

A real project might have Contact.cpp, ContactBook.cpp, and main.cpp, each depending on the others. Manually typing out every file and every compiler flag by hand, every single time, is genuinely tedious and error-prone โ€” especially across different machines with different compilers or library locations.

๐Ÿ“ A Minimal CMakeLists.txt
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(ContactBook)

set(CMAKE_CXX_STANDARD 17)

add_executable(contactbook main.cpp Contact.cpp ContactBook.cpp)

CMake reads this configuration file and GENERATES the actual build instructions for your specific platform โ€” you describe WHAT you want built, and CMake figures out HOW, on whatever machine it's run on. add_executable lists every source file that goes into the final program.

โš™๏ธ The Typical Build Commands
Terminal
mkdir build
cd build
cmake ..
cmake --build .

This directly builds on the Pre-Course's terminal navigation (mkdir, cd). Building in a separate build folder โ€” rather than mixing generated files with your actual source code โ€” is standard, genuinely widespread practice.

๐Ÿง  Quick Check
What is CMake's actual role in building a C++ project?
MODULE 03

๐Ÿ” Using a Debugger

The Pre-Course's "print the counter" trick has real limits. A genuine debugger lets you pause a running program and inspect it directly, without touching your source code at all.

๐Ÿ›‘ Breakpoints โ€” Pausing Exactly Where You Need To

A breakpoint marks a specific line where execution should pause โ€” most IDEs (including this platform's CLion GUI Development course) let you set one by clicking in the margin next to a line number. When the program reaches that line, it freezes, letting you inspect exactly what's happening at that precise moment.

๐Ÿ”ฌ What You Can Actually Inspect, Once Paused
FeatureWhat It Shows You
Variable inspectionThe CURRENT actual value of every variable in scope, at that exact moment
Call stackWhich functions called which other functions to reach this exact point โ€” directly useful for Phase 3's recursion
Step over / step intoRun the very next line and pause again (step over), or follow execution INTO a function call to watch it from the inside (step into)
๐ŸŽฏ Why This Beats Phase 2's Print-Statement Debugging

The Pre-Course's Module 13 print-statement trick is genuinely useful for quick checks, but it requires you to guess in advance what to print, and requires editing (then removing) code just to look. A debugger lets you inspect ANYTHING, at ANY paused moment, without changing a single line of your actual source code โ€” genuinely faster once you're comfortable with it, especially for a bug whose exact cause isn't obvious yet.

๐Ÿง  Quick Check
What is the core advantage of using a debugger's breakpoints over adding temporary print statements?
MODULE 04

๐Ÿ“š Version Control โ€” Git Basics

A genuinely essential, universal professional skill โ€” tracking every change to your code over time, and being able to safely go back.

๐Ÿ“ธ What Git Actually Does

Git takes a snapshot of your entire project every time you make a commit โ€” a saved checkpoint you can always return to. This isn't about "saving the file" the way you already do in your editor โ€” it's a genuinely complete history of every meaningful change, with the ability to see exactly what changed, when, and why.

๐Ÿ”‘ The Essential Commands
Terminal
git init                          # start tracking a project
git add main.cpp                  # stage a specific file's changes
git commit -m "Add contact search"  # save a checkpoint, with a message
git log                           # view the full history of commits

git add stages WHICH changes you want included in the next checkpoint; git commit actually saves that checkpoint, with a message describing what changed and why โ€” genuinely similar in spirit to Module 1's #Setting Up a Real Project habit from Phase 1, just tracking every version instead of only the current one.

๐ŸŒฟ Branches โ€” Working on Something Without Breaking What Works
Terminal
git branch new-feature      # create a new, separate line of development
git checkout new-feature    # switch to working on it

A branch lets you experiment or build a new feature genuinely separately from your main, working code โ€” if the experiment doesn't work out, you can abandon it entirely without ever having risked the working version.

๐Ÿง  Quick Check
What does a git commit actually create?
MODULE 05

โš ๏ธ Compiler Warnings & Flags

The Pre-Course's g++ main.cpp -o program has been silently NOT telling you about a whole category of real, genuine risks this entire time.

โš ๏ธ Errors vs. Warnings

The Pre-Course's Module 13 covered ERRORS โ€” mistakes that stop compilation entirely. A warning is different: the code IS technically valid and WILL compile, but the compiler has noticed something that's very likely a real mistake anyway โ€” an unused variable, a suspicious comparison, a possible uninitialized value.

๐Ÿšฉ Turning On More Warnings
Terminal
g++ -Wall -Wextra main.cpp -o program

-Wall ("all warnings," though genuinely not literally every possible one) and -Wextra enable significantly more warning categories than the compiler's bare default โ€” catching real, genuine issues like Phase 1 Module 6's forgotten-variable-initialization trap, or an unused function parameter, well before they become confusing runtime bugs.

๐Ÿšจ A Genuinely Strict, Recommended Habit
๐Ÿ’ก
-Werror turns every warning into a real, blocking errorAdding -Werror makes the compiler refuse to finish compiling if ANY warning appears โ€” forcing you to genuinely address every one rather than letting them silently accumulate. Many professional teams enable this by default specifically because warnings, left ignored, tend to hide real bugs.
๐Ÿง  Quick Check
What's the key difference between a compiler error and a compiler warning?
MODULE 06

๐Ÿ”ฌ Static Analysis Tools

Module 4's compiler warnings are genuinely useful, but a dedicated static analysis tool goes considerably further โ€” catching real bugs the compiler itself never flags at all.

๐Ÿ”ฌ What "Static" Means Here

Static analysis examines your source code WITHOUT ever actually running it โ€” genuinely different from Module 2's debugger, which inspects a program while it's actively executing. A static analyzer traces through possible code paths mathematically, looking for patterns that are almost always real bugs.

๐ŸŽฏ The Kinds of Real Bugs It Catches
ToolGenuinely Catches
cppcheckMemory leaks (Phase 4 Module 7), null pointer dereferences (Phase 4 Module 9), buffer overflows (Phase 3 Module 2)
clang-tidyModern C++ style issues, plus many of the same categories cppcheck catches
๐Ÿ’ก
This directly targets this ENTIRE roadmap's recurring warning topicsNearly every "genuine trap" or "โš ๏ธ warning" callout across all 12 phases so far โ€” dangling pointers, uninitialized memory, out-of-bounds access โ€” is exactly the category of bug static analysis tools are specifically designed to catch automatically, before you'd ever discover it the hard way at runtime.
๐Ÿง  Quick Check
What's the key difference between static analysis and using a debugger?
MODULE 07

โœ… Unit Testing Basics

Manually re-running a program and eyeballing the output โ€” exactly what every capstone in this roadmap has asked you to do โ€” genuinely doesn't scale as a project grows.

โœ… A Test Is Just Automated Verification
C++ โ€” a simple test, no framework needed
void testGetMax() {
    if (getMax(5, 3) != 5) {
        std::cout << "FAIL: getMax(5, 3) should be 5" << std::endl;
    } else {
        std::cout << "PASS: getMax(5, 3)" << std::endl;
    }
}

A unit test is genuinely just this โ€” code that calls another piece of code and CHECKS whether the result matches what you expect, automatically. This is Phase 9's getMax template, now genuinely verified by code instead of by you manually reading printed output and judging it yourself.

๐Ÿงช A Real Framework โ€” Catch2 (Briefly)
C++ โ€” using the Catch2 framework
TEST_CASE("getMax works correctly") {
    REQUIRE(getMax(5, 3) == 5);
    REQUIRE(getMax(1, 10) == 10);
}

A real testing framework like Catch2 (or Google Test) handles all the pass/fail reporting, running hundreds of tests automatically, and giving a clear summary โ€” you focus purely on writing the actual checks (REQUIRE), not the reporting machinery around them.

๐ŸŽฏ Why This Matters for "Job-Ready"

Real, professional codebases have hundreds or thousands of tests, run automatically every time code changes โ€” catching a bug the MOMENT it's introduced, not weeks later when a user reports it. Writing testable code (small, focused functions with clear inputs/outputs โ€” genuinely everything Phase 3's functions module emphasized) is a real, expected professional skill, not an optional extra.

๐Ÿง  Quick Check
What does a unit test genuinely do, at its core?
MODULE 08 ๐Ÿ

๐Ÿ Capstone โ€” Setting Up a Real Project

Every idea from this phase, combined โ€” not a program to write, but a genuine professional WORKFLOW to set up, from scratch, exactly as you would for a real job.

๐ŸŽฏ The Goal

Take Phase 11's Contact Book capstone and give it a genuine professional project structure: organized into multiple files, built with CMake, tracked with git, compiled with strict warnings enabled, and covered by at least one real unit test.

๐Ÿ“ The Target Structure
contact-book/ โ”œโ”€โ”€ .git/ โ† Module 3 โ”œโ”€โ”€ CMakeLists.txt โ† Module 1 โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ main.cpp โ”‚ โ”œโ”€โ”€ Contact.h โ”‚ โ”œโ”€โ”€ Contact.cpp โ”‚ โ”œโ”€โ”€ ContactBook.h โ”‚ โ””โ”€โ”€ ContactBook.cpp โ””โ”€โ”€ tests/ โ””โ”€โ”€ test_contact.cpp โ† Module 6
๐Ÿ“ A Genuine CMakeLists.txt for This Structure
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(ContactBook)

set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall -Wextra)   # Module 4 โ€” real warnings, every build

add_executable(contactbook
    src/main.cpp
    src/Contact.cpp
    src/ContactBook.cpp
)
๐Ÿ” The Full Workflow, Start to Finish
  1. git init โ€” start tracking the project (Module 3)
  2. Split the single-file capstone into separate .h/.cpp files by responsibility โ€” Contact's own logic separate from ContactBook's file-loading logic
  3. Write CMakeLists.txt with -Wall -Wextra enabled from the very start (Module 4)
  4. mkdir build && cd build && cmake .. && cmake --build . โ€” the genuine build workflow (Module 1)
  5. Write one real test verifying saveContacts/loadContacts genuinely round-trips correctly (Module 6)
  6. git add . && git commit -m "Initial project structure" โ€” the first real checkpoint (Module 3)
๐Ÿ The Real Test

Do This With Your Own Earlier Capstone

Pick any capstone from an earlier phase in this roadmap โ€” the number guessing game, the BankAccount class, the generic Stack โ€” and genuinely set it up this exact way: split into files, CMake, git, warnings, one test. This is precisely the transition from "I can write C++ syntax" to "I can work on a real C++ project," and it's worth doing for real, not just reading about.

Roadmap