Learn C++
#include "gettingstarted/install.hpp"

Installing a Compiler & Setting Up in C++

//concept

C++ has no single official download — you need a compiler, and the standard choice is GCC's g++ (Linux/macOS via Xcode tools) or MinGW-w64 on Windows, with Clang and MSVC as the other mainstream options. All implement the same ISO language, so learning on any one of them transfers directly.

Setup is one install plus a terminal check: g++ --version should print a version number, and compiling a file is a single command. An editor like VS Code with the C++ extension adds inline errors and one-click builds, but the compiler itself is the only hard requirement.

//how it works
1

Pick a compiler

g++ (GCC) on Linux, Xcode command-line tools on macOS, or MinGW-w64 / MSVC on Windows — all compile standard C++ the same way.

2

Install it

Linux package managers ship g++ directly; macOS gets Clang via xcode-select --install; Windows users install MinGW-w64 or Visual Studio.

3

Verify the install

Running g++ --version in a terminal should print a version like 13.x — if it says command not found, the compiler's folder isn't on your PATH yet.

4

Pick an editor

VS Code with Microsoft's C/C++ extension is the common free setup; it highlights errors as you type and builds with a shortcut.

//example
$ g++ --version
$ g++ hello.cpp -o hello
Output
g++ (GCC) 13.2.0
(compiles hello.cpp into a runnable program named hello)
1g++ --version asks the compiler to identify itself — success means it is installed and on your PATH.
2g++ hello.cpp -o hello compiles the source file and names the output program hello (a.out by default if -o is skipped).
3Running ./hello then executes that native program directly — no interpreter or virtual machine involved.
//use cases
Setting up a new machine or lab computer before any C++ work can start
Diagnosing a teammate's command not found error during onboarding
Choosing a C++ standard with -std=c++17 or -std=c++20 when a project needs newer features
Configuring VS Code's build task so one shortcut compiles and runs the current file

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Classic DSA interview booksThe reference books interviewers themselves learned from — great next to the visualizers.See the books

Practice what you learned

Re-implement each visualized algorithm in C++ yourself — building beats watching.