Compiler and Tools Setup

Install Compiler Toolchain

First, you will need to install a compiler - the program that will build your code once it is written. The instructions for this vary based on your platform:

PC

MinGW is the name of a project to make the gcc compiler available on Windows. Use this link to download the file mingw64.zip.

Once downloaded, find the file in Windows Explorer. Right-click it and select Extract All.... For the location, type: C:\.

Once this is done, your C: drive should have a folder called mingw64 in it. In that folder, you should see folders called bin, opt, lib, etc...

Now you need to add C:\mingw64\bin to your Path (the list of folders Windows looks in for programs it can run). To do so, follow these Add to the PATH instructions. After pressing New to add a new item to the Path, type or copy/paste in C:\mingw64\bin.

This video demonstrates the process:

Mac

You will need to install the XCode command line development tools. You can do this either by typing a command or using the app store:

  1. To install via a command, open a Terminal window. Then type the following:

    xcode-select --install
    

    For more information, check out this page which has screenshots and a video of the process.

  2. Alternatively, you can install the full XCode application (Apple's official development environment). This is a larger install but also sets up your computer to do development specifically for OSX and/or iOS. To do this method, simplify find XCode in the app store and install it.

Linux

You need to install packages that contain gcc, gdb, and make (among other tools). On Ubuntu and other apt-based distros you can do this by running the following commands in a terminal:

sudo apt update
sudo apt install build-essential
sudo apt install gdb

Testing the compiler

To confirm the compiler is installed, open a terminal window (Terminal/Power Shell/Command Prompt on Windows, Terminal on Mac). and type the following:

g++

If you get an error saying something like g++: fatal error: no input files, you are good to go. If you get an error saying something like g++ is not recognized as a command, you still need to fix your setup.


Continue to the next page to set up Visual Studio Code.