Thuta Learning
BasicProgrammingbeginner

Get Started (Setup)

Relax. We'll talk through this in plain words — no textbook voice.

To run C++ code, you need a compiler. A compiler is a tool that turns the .cpp source code you write into an executable program the computer can understand. You can get started with an online playground, but once you want to build real projects, knowing how to set things up locally becomes essential.

cpp
# Save your file as hello.cpp
# Compile with g++
g++ hello.cpp -o hello

# Run on macOS/Linux
./hello

# Run on Windows PowerShell
.\hello.exe

hello.cpp is the source file, and g++ is the compiler. -o hello names the output program hello. Compiling first and then running is the standard C++ workflow.

You should see
If compile succeeds, your program runs and prints the output from your code.

Info

On Windows you can use MinGW-w64 or the Visual Studio Build Tools, on macOS the Xcode Command Line Tools, and on Linux the g++ package.

Easy traps

  • If your terminal can't find the g++ command, it likely means the compiler isn't installed yet, or it hasn't been added to your PATH.
Get Started (Setup) | Thuta Learning