Lesson 2 of 6
If you're on macOS or Linux, skip to the lesson for your system — this one's Windows-only.
The recommended path: WSL
WSL (Windows Subsystem for Linux) lets you run a real Linux environment inside Windows, side by side with everything you already have. It's the path Microsoft's own documentation recommends for C++ development on Windows, and it means every command and tool in this whole module works exactly as written, with no Windows-specific quirks to translate.
Step 1: Install WSL
Open PowerShell as Administrator (right-click the Start button, choose "Terminal (Admin)" or "Windows PowerShell (Admin)") and run:
wsl --install
This installs WSL along with Ubuntu, a popular Linux distribution. Restart your computer when it asks you to.
Step 2: Finish Ubuntu setup
After restarting, Ubuntu should open automatically (if not, search for "Ubuntu" in the Start menu). The first time it runs, it'll ask you to create a username and password for this Linux environment — these can be anything, and don't need to match your Windows login. You won't see the password as you type it; that's normal, just type it and press Enter.
Step 3: Install the compiler and tools
You're now looking at a Linux terminal, running inside Windows. Run these two commands:
sudo apt update
sudo apt install build-essential gdb
sudo runs a command with administrator privileges — it'll ask for the password you just
created. build-essential is a bundle that includes g++ (the compiler this whole curriculum
uses) along with the other basic tools a C++ project needs. gdb is a debugger you'll use later
in the curriculum.
Step 4: Confirm it worked
g++ --version
You should see a version number printed (this curriculum assumes a reasonably recent version —
anything from the last few years is fine). If you see g++: command not found instead, the
install didn't complete — scroll back up and re-run Step 3.
Working with your files
WSL has its own Linux filesystem, separate from your normal C:\ drive. For this course, create
a folder for your work inside WSL itself:
mkdir ~/cpp-course
cd ~/cpp-course
You'll come back to this folder (or one like it) every lesson. ~ means "my home folder" — you
can type it instead of a long path.
Checkpoint
- WSL gives you a real Linux environment inside Windows — the recommended way to do C++ development on Windows.
wsl --installsets it up; a restart and a one-time Ubuntu username/password follow.sudo apt install build-essential gdbinstalls the compiler and debugger.g++ --versionconfirms it worked.- Next up: installing VS Code and connecting it to this WSL environment.
Questions about this lesson
Log in to ask a question.