Windows

To install a C++ compiler and debugger on Windows, download the installer free of charge from the following address:

https://www.msys2.org/

Once the download is complete, run the corresponding installer. Complete the installation process, ensuring to keep the recommended installation folder (C:\msys64). In the final window of the installation process, ensure the “Run MSYS2 now” field is checked and click on the “Finish” button.

In the terminal window that opens, install the MinGW-w64 toolchain by running the following command:

pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

Accept the default number of packages in the toolchain group by hitting the “Enter ⤶” key.

Figure 1 Installing the MinGW-w64 toolchain

Enter Y when prompted to proceed with the installation and hit the “Enter ⤶” key.

Once the installation process finishes, close the terminal window.


Linux (Ubuntu and Debian)

Before installing a C++ compiler and debugger on Linux, you should update the system repositories. This ensures that all of your systems software is up-to-date, reducing the likelihood of compatibility issues. Open a terminal and run the following commands.

sudo apt update -y
sudo apt upgrade -y

Next, run the following command to install a C++ compiler and debugger.

sudo apt install build-essential -y