Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Setting Up Your Environment  ›  Lesson

Installing a Compiler

Installing C++ 12 minInstalling C++ means installing a compiler such as GCC, Clang or MSVC, checking it runs, and choosing which language standard it should use.

Installing a Compiler

You want to build Rocket Run on your own laptop. There is no single "C++" program to download. What you install is a compiler, and there are three big families. Pick the right one for your system and a two-minute check tells you it works.

The rule

You don't install C++; you install a compiler that speaks it.

The three major compilers:

  • GCC, run as g++. The standard choice on Linux.
  • Clang, run as clang++. The default on macOS, also common on Linux.
  • MSVC, Microsoft's compiler, installed with Visual Studio on Windows.

How to get one:

# Linux (Debian or Ubuntu)
sudo apt install g++

# macOS: installs Apple Clang and the command line tools
xcode-select --install

# Windows: install Visual Studio Community and tick
# the "Desktop development with C++" workload
# (or install MSYS2 if you prefer GCC)

One surprise on macOS: typing g++ there runs Apple Clang under a familiar name. That is fine for learning.

Each compiler supports several language standards. Tell it which one you want:

g++ -std=c++20 rocket.cpp -o rocket

The shortcut

Three words: install, verify, pin.

Setting up a Linux laptop for Rocket RunStep 1 of 4
  1. Install

    Run sudo apt install g++. The package manager fetches GCC and the standard library.

The trap is thinking an editor is a compiler. Installing VS Code, or any editor, gives you somewhere to type. It does not give you anything that can turn C++ into a program. If a command says g++: command not found, the compiler is missing or not on your PATH.

Drills

Answer fast — trust the rule.

quick drill

Which command checks that GCC is installed and reachable?

quick drill

On a Mac after xcode-select --install, what does the g++ command actually run?

quick drill

Which flag tells g++ to compile using the C++20 rules?

quick drill

A Windows user wants Microsoft's own C++ compiler. What should they install?

Remember

  • You don't install C++; you install a compiler that speaks it: GCC, Clang or MSVC.
  • Shortcut: install, verify with --version, pin the standard with -std=.
  • Trap: an editor is not a compiler.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainGetting a teammate ready

A new Rocket Run teammate says, "I installed VS Code, so I have C++ now." Explain what they are missing, how they would get it on their operating system, and how they can check it worked.