This page mainly introduces the installation steps for various compilers/interpreters on different systems.
GCC
Windows
Manual download and installation
Visit the MinGW-w64 download page, which offers multiple builds. For convenience, we use a build provided by WinLibs.
First, go to WinLibs to download the latest package. Choose an appropriate version; this article uses GCC 12.3.0 + LLVM/Clang/LLD/LLDB 16.0.4 + MinGW-w64 11.0.0 (UCRT):
LLVM Clang is included by default. If you do not want to install it, you can choose the "without LLVM/Clang/LLD/LLDB" option on the right.

After downloading, extract it to a location on your computer. In this tutorial, it is extracted to the root directory of the C drive. It is best for the directory name not to contain non-English characters or spaces, otherwise this may cause problems later.

Next, we need to add the directory containing the compiler's executable files to the system environment variables, so that we do not need to specify the compiler path when compiling. Above, we extracted MinGW to the C:\mingw64 directory, so the directory containing the executable files is C:\mingw64\bin.
Press the Windows logo key + R, enter rundll32.exe sysdm.cpl,EditEnvironmentVariables, open the system environment variable settings window, select the variable named "Path" in the "System variables" section, and then click the "Edit" button:

In the edit window, click the "New" button on the right to create an entry for the "Path" variable, and enter the directory containing the executable files recorded above (in this tutorial, C:\mingw64\bin).

Note for some older system versions
Some older system versions only allow you to manually modify the text value of the variable. In that case, insert a half-width semicolon at the end of the variable's value, then paste the directory containing the executable files after this half-width semicolon, as shown in the figure:

After that, keep clicking the "OK" button to exit.
Next, open a terminal, enter g++ --version, and press Enter. If a message like the one shown in the figure appears, the installation was successful.

Scoop installation
Open PowerShell and run the following script:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
scoop install mingw-winlibs
Linux
Debian/Ubuntu
First update the package list:
sudo apt update
Then install it directly with the command:
sudo apt install g++
Arch Linux
Install it directly with the command:
sudo pacman -Syu gcc
openSUSE
Install it directly with the command:
sudo zypper in gcc-c++
macOS
First update the package manager:
brew upgrade
brew update
Then install it directly with the command:
brew install gcc
JDK
There are many JDK distributions. Two of them are introduced below:
- Eclipse Temurin1 in OpenJDK: see Install Eclipse Temurin™ | Adoptium.
- Oracle JDK: see JDK Installation Guide (JDK 17).
Python 3
There are also many Python implementations2. Taking CPython 3 as an example, see Download Python | Python.org.
LLVM
Windows
A pitfall of LLVM on Windows
Because LLVM lacks a standard library on Windows, you still need to install MSVC or GCC.
Direct installation
Visit the LLVM download page and choose LLVM-*-win64.exe to download.
If your network quality is poor, you can instead visit the Tsinghua University Open Source Software Mirror to download it.
Open the .exe file, check Add LLVM to system PATH for current user during installation, and keep clicking Next to complete the installation.
Open a terminal, enter clang++ --version, and press Enter. If output similar to the following appears,
clang version 15.0.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: <omitted>
it indicates success.
Scoop installation
Open PowerShell and run the following script:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
scoop install llvm
Linux
openSUSE
Install it directly with the command:
sudo zypper in llvm clang
MSVC (Visual Studio)
Visit the Download Visual Studio page. Find the "Community" section under "Downloads" and click "Free download". After the download is complete, open the installer and select "Community 2022 installation". In the window that then pops up, select only "Desktop development with C++", and then click Install.
If you do not want to install the complete Visual Studio, scroll down to the "All downloads" section and find "Visual Studio Build Tools" under "Tools for Visual Studio", then click "Download" next to it. After the download is complete, open the installer and follow the prompts to select "Desktop development with C++" and install it. You can also use the PortableBuildTools tool to install only the MSVC compiler.
Footnotes
-
Eclipse Temurin is the former AdoptOpenJDK, which was transferred to the Eclipse Foundation in July 2021. See this statement for details. ↩