0.5 — Setting up your tools
To write C++, you need a compiler and somewhere to type code. Pick one option below.
Option 1: Try it in your browser (easiest)#
No install needed. Open a website, type code, press Run.
- Compiler Explorer — pick C++ and add an output window.
- OnlineGDB — very simple. Write, press Run.
- Coliru — tiny and fast.
Online tools are perfect for the first few chapters. Install real tools later, when you want to build bigger things.
Option 2: Windows#
Install Visual Studio Community (free). During setup, tick "Desktop development with C++".
Then: Create a new project → Console App → press the green ▶ button to run.
Option 3: Mac#
Open the Terminal app and type:
xcode-select --installThis gives you a compiler called clang. You can then use the editor VS Code with the C++ extension, or just the terminal.
Option 4: Linux#
Install the g++ compiler with your package manager. On Ubuntu:
sudo apt install g++Running from a terminal#
If you use a terminal, save your code as main.cpp, then type:
g++ -std=c++20 -Wall main.cpp -o hello./hello-std=c++20= use modern C++.-Wall= show all warnings. This catches many mistakes early.-o hello= name the programhello.
Short for Integrated Development Environment. An app that puts an editor, compiler and debugger together in one place. Visual Studio and CLion are IDEs.
Tip: press ← / → to move between lessons, / to search.