Install a C++ Compiler in C++

From the C++ cheat sheet ยท Setup ยท verified Jul 2026

Install a C++ Compiler

Install G++ or Clang++, verify it, and compile a C++ source file.

bash
# Ubuntu or Debian
sudo apt update
sudo apt install build-essential
g++ --version
๐Ÿ“Œ build-essential includes G++ on Debian systems
๐Ÿ’ก Xcode Command Line Tools provides Clang++ on macOS
๐Ÿ” Use c++ when either G++ or Clang++ is acceptable
๐ŸŽฏ Pass the language standard explicitly for consistent builds
installcompilerg++clang++

Continue with C++

Save the full cheat sheet or work through every related task.

Back to the full C++ cheat sheet