Tutorial
C++ Tutorial
A hands-on C++ tutorial designed to get you job-ready. Covers tooling, memory management, OOP, modern C++, the STL, build systems, and best practices.
Chapters
01
C++ Tutorial: From Zero to Productive
02
Chapter 1: Tooling and Environment Setup
03
Chapter 2: Basic Syntax and Fundamentals
04
Chapter 3: Memory Management
05
Chapter 4: Object-Oriented Programming in C++
06
Chapter 5: Modern C++ Features (C++11 through C++23)
07
Chapter 6: The Standard Template Library (STL)
08
Chapter 7: Build Systems and Project Structure
09
Chapter 8: Best Practices and Common Pitfalls
10
Chapter 9: Practical Projects
11
Chapter 10: The C++ Ecosystem and Essential Knowledge
About this tutorial
A hands-on C++ tutorial designed to get you job-ready.
Ref: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
Quick Start
# Compile and run your first program
cd examples
g++ -std=c++20 -Wall hello.cpp -o hello
./hello
# Or use the project template
cd projects
cmake -B build
cmake --build build
./build/myapp
Tutorial Contents
| Chapter | Topic | Description |
|---|---|---|
| 00 | Introduction | Why C++, market demand, tutorial overview |
| 01 | Tooling Setup | Compilers, IDEs, debuggers, build basics |
| 02 | Basic Syntax | Variables, types, functions, control flow |
| 03 | Memory Management | Pointers, references, RAII, smart pointers |
| 04 | OOP | Classes, inheritance, polymorphism |
| 05 | Modern C++ | C++11 through C++23 features |
| 06 | STL | Containers, algorithms, iterators |
| 07 | Build Systems | CMake, package managers, project structure |
| 08 | Best Practices | Idioms, patterns, common pitfalls |
| 09 | Projects | Hands-on coding exercises |
| 10 | Ecosystem | Terminology, community, career paths |
Prerequisites
- Basic programming experience in any language
- Command line familiarity
- A C++ compiler (GCC, Clang, or MSVC)
Directory Structure
cpp/
├── README.md # This file
├── 00-introduction.md # Start here
├── 01-tooling-setup.md
├── ...
├── 09-projects.md
├── examples/ # Small code examples
│ └── hello.cpp
└── projects/ # Project templates
├── CMakeLists.txt
└── main.cpp
Recommended Learning Path
- Week 1-2: Chapters 00-02 (Setup, Basics)
- Week 3-4: Chapters 03-04 (Memory, OOP)
- Week 5-6: Chapters 05-06 (Modern C++, STL)
- Week 7-8: Chapters 07-09 (Build Systems, Best Practices, Projects)
Compile Commands Reference
# Simple compilation
g++ -std=c++20 -Wall file.cpp -o program
# Debug build
g++ -std=c++20 -Wall -g -O0 file.cpp -o program_debug
# Release build
g++ -std=c++20 -Wall -O2 file.cpp -o program_release
# With sanitizers (debugging)
g++ -std=c++20 -Wall -g -fsanitize=address,undefined file.cpp -o program
# CMake build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
Resources
Happy learning!