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:
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.
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:
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.
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.