Lesson 5 of 6
You now have a compiler. Next you need somewhere pleasant to write code — VS Code is free, runs on every platform, and is what a large share of professional C++ developers actually use.
Install VS Code
Go to code.visualstudio.com and download the installer for your operating system, then run it, accepting the defaults.
Install the C/C++ extension
Open VS Code, then:
- Click the Extensions icon in the left sidebar (it looks like four squares, one detached).
- Search for "C/C++".
- Install the one published by Microsoft — it's usually the first result.
This extension gives you syntax highlighting, autocomplete, and inline error checking as you type, instead of only finding out about mistakes when you try to compile.
Windows only: connect VS Code to WSL
If you set up WSL in an earlier lesson, VS Code on Windows needs one more extension to reach into it:
-
Search the Extensions panel for "WSL" and install the one published by Microsoft.
-
Open your Ubuntu terminal (the one from the WSL lesson) and, inside your course folder, run:
code .The first time you do this, VS Code installs a small server component inside WSL — let it finish. After that,
code .opens a VS Code window that's actually editing files inside WSL, with yourg++andgdbavailable in its built-in terminal.
From now on, whenever these lessons say "open your terminal," Windows users should mean the VS
Code terminal opened this way (or the WSL Ubuntu app directly) — not PowerShell or Command
Prompt, which don't have g++ installed.
Open VS Code's terminal
You'll use VS Code's built-in terminal constantly in this course, so find it now: menu Terminal → New Terminal, or the keyboard shortcut shown next to it. This opens a terminal panel at the bottom of the editor — the same kind of terminal you used in the previous lesson, just inside VS Code instead of a separate window.
Checkpoint
- VS Code is free, cross-platform, and widely used for real C++ work.
- The Microsoft C/C++ extension adds autocomplete and inline error checking.
- Windows users also need the WSL extension, and should open their project with
code .from inside their WSL terminal. - VS Code has a built-in terminal (Terminal → New Terminal) — use it instead of a separate terminal app from here on.
- Next up: writing and running your first real program.
Questions about this lesson
Log in to ask a question.