Lesson 4 of 6
If you're on Windows or macOS, skip to the lesson for your system — this one's Linux-only. (If you set up WSL in the Windows lesson, that's Ubuntu underneath — use the Debian/Ubuntu instructions below, inside your WSL terminal, not this lesson.)
Install the compiler and tools
Open a terminal and run the commands for your distribution.
Ubuntu, Debian, and anything based on them (Mint, Pop!_OS, ...):
sudo apt update
sudo apt install build-essential gdb
Fedora:
sudo dnf install gcc-c++ gdb
Arch, Manjaro:
sudo pacman -S base-devel gdb
sudo runs the command with administrator privileges — it'll ask for your password. If you're
not sure which distribution you're running, cat /etc/os-release prints its name.
Confirm it worked
g++ --version
You should see a version number printed. If you get "command not found," the install above didn't complete — check for error messages and try again.
Working with your files
Create a folder for this course:
mkdir ~/cpp-course
cd ~/cpp-course
~ means your home folder. You'll come back here every lesson.
Checkpoint
- Every major Linux distribution has
g++andgdbin its package manager, under slightly different package names. g++ --versionconfirms the install worked.- Next up: installing VS Code and the C++ extension.
Questions about this lesson
Log in to ask a question.