To compile and execute C++ programs on your computer, you need two fundamental components: a C++ Compiler (which translates your human-readable C++ code into binary machine instructions) and an IDE or Code Editor (such as VS Code, CLion, or Visual Studio).
MinGW-w64 is the premier native GCC compiler suite for 64-bit Windows systems. Follow these exact steps:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
C:\msys64\ucrt64\bin to your Windows System Environment Variables Path.g++ --version
Linux operating systems make C++ installation effortless via the package manager:
# For Ubuntu / Debian / Linux Mint:
sudo apt update
sudo apt install build-essential gdb clang
# For Fedora / Red Hat:
sudo dnf groupinstall "Development Tools"
sudo dnf install gcc-c++ gdb
On macOS, Apple provides Clang via the official Xcode Command Line Tools:
xcode-select --install
clang++ --version
VS Code is the most popular editor among students and professionals. Set it up in 3 easy steps:
ms-vscode.cpptools).cpp-practice and open it in VS Code.main.cpp and write your test program. Press Ctrl + ` to open the integrated terminal and compile manually:# Compile with standard warnings and C++20 standard:
g++ -std=c++20 -Wall -Wextra main.cpp -o main
# Run on Windows:
.\main.exe
# Run on Linux / macOS:
./main
Boost your C++ proficiency by studying these closely connected core modules:
Understand preprocessor, assembler, and linker stages.
Write and execute your first program on your new setup.
Learn how console input/output works in modern C++.