Installing C++ locally

Learn how to install C++ locally to solve Exercism's exercises on your own machine


The C++ language track requires that you have the following software installed on your system:

  • a modern C++14 compiler
  • the CMake cross-platform build system

We use Catch2 for testing, which is a header-only library that is bundled along with the exercises.

This set of dependencies is very common for C++ projects, so if you have any issues setting it up you will find many helpful resources online.

Many IDE's, including Microsoft's Visual Studio, Apple's Xcode, and JetBrains' CLion bundle a compiler and CMake together, so you should only need to install the IDE.

A Modern C++14 Compiler

This language track requires a compiler with C++14 support, which was released in 2014. All major compilers released in the last few years should be compatible, so as long as you are on a fairly recent version you should be fine. Specifically, GCC version 7 or later, Clang version 6 or later, or Visual Studio 2017 or later.


CMake is an open source cross-platform build system that generates build scripts for your native build system (make, Visual Studio, Xcode, etc.). Exercism's C++ track uses CMake to give you a ready-made build that:

  • compiles the tests
  • compiles your solution
  • links the test executable
  • automatically runs the tests as part of every build
  • fails the build if the any tests fail

Using CMake allows exercism to provide a cross-platform build script that can generate project files for integrated development environments like Visual Studio and Xcode. This allows you to focus on the problem and not worry about setting up a build for each exercise.

Getting a portable build isn't easy and requires access to many kinds of systems. If you encounter any problems with the supplied CMake recipe, please report the issue so we can improve the CMake support.

CMake 3.5.1 or later is required to use the provided build recipe.


Windows users can get Visual Studio Community, a free download that will give you the Visual Studio IDE and the latest version of the Microsoft Visual C++ compiler.

  1. Follow the instructions here to setup CMake.
  2. Download the exercise using the exercism cli tool.
  3. Open Visual Studio 2017 or higher (With Visual C++ tools for CMake installed as described from the link above).
  4. Open the exercise folder in VS.
  5. Run "Build->Build the solution". The tests will execute with the build, with the output going to the build window. Since the test runs during the build, VS will say it is a build failure if one of the tests fail, and the test failure messages will be in the build output window.

You should be able to use other integrated IDE's such as JetBrains' CLion in a similar manner.


All recent Linux distribution releases have compatible C++14 compilers, you should be able to install it using your package manager. The versions we support are the default installed versions in Ubuntu LTS 18.04.

For example, on Ubuntu you would use the following command to install gcc.

$ sudo apt-get install gcc
$ gcc --version

If you are on an older distribution, you might not have a compiler that supports C++14. If that's the case, you'll need to work with your distribution to figure out how to install the minimum compiler version.


MacOS users can install GCC with Homebrew via brew install gcc.