To build the SDK, you will need a compiler that can compile C++ 11 code or higher. C++ compilers vary based on platform, but listed below are a few of the most common and the minimum version required:
- Clang: 3.9 or higher
- GCC: 4.8 or higher
- MSVC: 2015 or higher
Listed below are ways to install C++ 11 compilers on Windows, MacOS, and Linux.
You will also need CMake to build the SDK. The minimum required version is CMake 3.1.
Below are the instructions to install CMake in a non-platform specific way:
- Download CMake3.1+ for your platform: https://cmake.org/download/
- Run the Cmake Installer. Make sure you add CMake into PATH.
- Restart the command prompt / terminal.
Listed below are also instructions to install CMake on Windows, MacOS, and Linux.
MinGW-w64 is a project that allows for GCC
compiler support on Windows. There are several ways to install MinGW-w64, and this document will explain the workflow for adding MinGW-w64 using MSYS2, a software distribution and building platform for Windows.
MinGW-w64 is fully supported on Visual Studio Code, a programming IDE that is a lightweight alternative to Visual Studio that supports many programming languages. The steps below are loosely based on the documentation for installing MinGW-w64 for Visual Studio code.
- Download and run the MSYS2 installer from the MSYS2 website.
- Follow the install instructions on the MSYS2 website.
- Make sure to follow the instructions on the website for updating the database and base packages!
- Installing MinGW-w64 may be part of these instructions. If so, install MinGW-w64 using the instructions there.
- If MinGW-w64 was not part of the install instructions for MSYS2, run
pacman -S --needed base-devel mingw-w64-x85_64-toolchain
. - Next you need to add MinGW to your windows
PATH
environment variables so you can run it from the terminal. - Open the Windows Settings. You can do this by typing
settings
into the search bar or by opening the Windows start menu and navigating to the Windows Settings (should be called "Settings") application. - Once the Windows Settings window is open, search for
Edit environment variables for your account
. - Select the
Path
variable in theUser variables
property and press theEdit
button. - Select
New
and then add the MinGW-w64bin
folder to this path. If you used the command in step 3, it should be located inC:\msys64\mingw64\bin
. If you installed using a different method, you will need to find themingw64/bin
folder on your computer. - Once you have added the path to the
Path
variable in theUser variables
property, selectOK
and save. - Close any console/terminal windows you have open. This is because the console/terminal will not see the updated
PATH
variable unless it is restarted by closing and reopening. - Confirm that MingW-w64 is installed by running either
g++ --version
orgdb --version
. You should get a print out showing the installed version of the C++ compiler.
Microsoft Visual C++ (MSVC) is a C++ compiler that is supported and maintained by Microsoft, and is supported by the C++ SDK. To install MSVC, you will need to install Visual Studio using the instructions below.
Install Visual Studio with MSVC
- Download Visual Studio Installer https://visualstudio.microsoft.com/downloads/
- Run the installer, check the Desktop development with C++ workload and select Install.
- Verify your MSVC installation
- In Windows Start up Menu, try open "Developer Command Prompt for VS".
- In the opened terminal/console window, type
cl.exe
and it should output the compiler version. - You can also find the compiler version by opening Visual Studio by selecting
help
and thenabout
.
If using MSVC, you will need to use the Developer Command Prompt instead of the standard terminal when compiling the SDK and samples.
If you installed MinGW-w64 via MSYS32
in the steps above, you can easily install CMake using the following:
- Run
pacman -S mingw-w64-x86_64-cmake
. - You will also need to install a build tool. You can install
ninja
ormake
. - To install
ninja
runpacman -S mingw-w64-x86_64-ninja
. - To install
make
runpacman -S mingw-w64-x86_64-make
. - Run
cmake --version
to check that CMake is properly installed.
You can also install CMake manually by following the install instructions on the CMake website:
- Download CMake3.1+ for Windows: https://cmake.org/download/
- Run the Cmake Installer.
- Next you need to add CMake to your windows
PATH
environment variables so you can run it from the terminal.
- Note: The installer should include an option to add CMake to the system path for all users. If you have checked this box, you can skip steps
5
through9
.
- Open the Windows Settings. You can do this by typing
settings
into the search bar or by opening the Windows start menu and navigating to the Windows Settings (should be called "Settings") application. - Once the Windows Settings window is open, search for
Edit environment variables for your account
. - Select the
Path
variable in theUser variables
property and press theEdit
button. - Select
New
and then add the CMakebin
folder to this path. If you do not modify the install path, it should be located aroundC:\Program Files (x86)\CMake.x.x
wherex.x
is the version. If you installed CMake to a different directory, then you will need to modify the path accordingly. - Once you have added the path to the
Path
variable in theUser variables
property, selectOK
and save. - Close any console/terminal windows you have open. This is because the console/terminal will not see the updated
PATH
variable unless it is restarted by closing and reopening. - Run
cmake --version
to check that CMake is properly installed.
XCode Command Line Tools is the easiest way to install C++ compilers on MacOS, as it is officially supported and maintained by Apple. By installing the XCode Command Line tools, you will automatically install clang
, which can compile C++ 11 code. One way to install XCode Command Line Tools is using brew
.
Brew is a command line package manager that makes it easy to install packages and software dependencies. The instructions to install through brew
are below:
- Open a new terminal and input the following command:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- If XCode Command Line Tools are not installed, the
brew
install process will ask if you want to install. Typey
to install. - Wait for
brew
to install the XCode Command Line Tools. This make take some time. - Once
brew
is finished, confirm the XCode Command Line Tools have installed by opening a new terminal and inputtingclang --version
.
If stuck waiting for brew
to install XCode Command Line Tools for over 15-20 minutes, you many need to cancel the installation (CTRL-C
in the terminal) and install XCode Command Line Tools though the installer.
You can also install XCode Command Line Tools manually through an installer download on Apple's website. The instructions to install through the installer are below:
- Go to developer.apple.com/downloads.
- Input your AppleID to access the developer downloads.
- From the presented list, scroll until you find
Command Line Tools for Xcode <version>
. - Select
view more details
and then selectAdditionals Tools for Xcode <version>.dmg
. - Once downloaded, double click the
.dmg
and follow the installer instructions. - Confirm XCode Command Line Tools have installed by opening a new terminal and inputting
clang --version
.
CMake can easily be installed using brew
, so if you installed brew
for XCode Command Line Tools, you can run the following to install CMake:
- Confirm you have
brew
installed:
brew --version
- Install CMake by running
brew install cmake
. - Close any console/terminal windows you have open. This is to refresh the console/terminal so it uses the latest changes.
- Confirm CMake is installed by running
cmake --version
.
You can also install CMake manually by following the install instructions on the CMake website:
- Go to cmake.org/install.
- Follow the install instructions for MacOS on the website page.
- Drag and drop the CMake application from the downloaded installer into your Applications folder. A window should open once you have mounted the CMake installer that easily allows you to do this via drag-and-drop.
- You may need to manually add CMake to your
path
so you can run it in the terminal. To do this, run the following command:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
- This will create the symlinks so you can run CMake from the terminal.
- Close any console/terminal windows you have open. This is to refresh the console/terminal so it uses the latest changes.
Many Linux operating systems have C++ compilers installed by default, so you might already clang
or gcc
preinstalled.
To test, try running the following in a new terminal:
clang --version
gcc --version
If these commands fail, then please follow the instructions below for installing a C++ compiler on your Linux operating system.
If your Linux operating system is not in the list, please use a search engine to find out how to install either clang
or gcc
on your Linux operating system.
- Open a new terminal
- (optional) Run
sudo apt-get update
to get latest package updates. - (optional) Run
sudo apt-get upgrade
to install latest package updates. - Run
sudo apt-get install build-essential
to install GCC orsudo apt-get install clang
to install Clang. - Once the install is finished, close the terminal and reopen it.
- Confirm GCC is installed by running
gcc --version
or Clang is installed by runningclang --version
.
- Open a new terminal.
- Run
sudo pacman -S gcc
to install GCC orsudo pacman -S clang
to install Clang. - Once the install is finished, close the terminal and reopen it.
- Confirm Clang is installed by running
gcc --version
.
There are several ways to install CMake depending on the Linux operating system. Several Linux operating systems include CMake in their software repository applications, like the Ubuntu Software Center for example, so you may want to check there first. Below are the instructions to install CMake for Ubuntu and Arch Linux.
If your Linux operating system is not in the list below, please use a search engine to find out how to install CMake on your Linux operating system. You can also always try to install CMake manually using the generic install instructions at the top of this page.
- Open the Ubuntu Software Center
- In the search bar enter
cmake
and selectCMake - cross-platform build system
from the list - Press the
install
button - After CMake has installed open a new terminal
- Type
cmake --version
to confirm CMake is installed
Or using the command line:
- Open a new terminal
- Run
sudo snap install cmake
to install CMake from the snap store - After CMake has installed, close the terminal and reopen it
- Type
cmake --version
to confirm CMake is installed
- Open a new terminal.
- Run
sudo pacman -S cmake
to install Cmake - After CMake has installed, close the terminal and reopen it
- Type
cmake --version
to confirm CMake is installed.