/* Setting up C++ */
In order to begin development in C++ you need to install a C++ compiler. There are a few different compilers you could install.
// Table of Contents
// Windows
Installing C++ on Windows is a bit more complicated than on other operating systems. In this guide we will be using the MinGW compiler. MinGW is a port of the GNU Compiler Collection (GCC) to Windows.
- Download the MinGW install from the MinGW website or from the direct link.
- In the installation wizard, choose a destination folder for MinGW. In most cases, the default location is recommended. Once it's completed make sure you check the Run MYS2 now box and select finish.
- A terminal window will open. In the terminal window, type the following command. This will install the MinGW-w64 toolchain.
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
- Make sure you accept the default number of packages in the toolchain by pressing Enter.
- Enter `Y` when prompted if you want to proceed with the installation.
- After installed you need to add your MinGW bin folder to your Window's PATH.
- Press the Windows key and search for Edit environment variables for your account.
- In the User variables section find and select the Path variable and click Edit.
- A popup will appear. Click New and paste the path to your MinGW bin folder. By default, it will be:
C:\msys64\ucrt64\bin
- Click OK on all the windows to close them.
- Verify that MinGW is installed by opening a command prompt and typing:
g++ --version gcc --version gdb --version
// Mac
Mac comes with the Clang compiler pre-installed. Clang is a C, C++, and Objective-C compiler that is part of the LLVM project.
- Open a terminal window and type the following command to check if Clang is installed.
clang --version
- If Clang is not installed you can install it by typing the following command.
xcode-select --install
// Linux
Linux comes with the GCC compiler pre-installed. GCC is a C, C++, and Fortran compiler that is part of the GNU project
- Open a terminal window and type the following command to check if GCC is installed.
gcc -v
- If GCC is not installed you can install it by typing the following commands.
sudo apt-get update sudo apt-get install build-essential gdb