Skip to content

Dependencies

C++17

Make sure your C++ compiler supports C++17:

1
g++ --version
1
clang --version

The output should be something like:

1
g++-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
1
Apple clang version 11.0.0 (clang-1100.0.33.8)

If you need to update your compiler:

1
2
3
4
# install GCC-8
sudo apt update
sudo apt install gcc-8
sudo apt install g++-8

To update to any other version, like GCC-9 or GCC-10:

1
2
3
4
sudo apt install build-essential
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install g++-10

Once you installed a newer version of GCC, you can link it to update-alternatives. For instance, if you have GCC-7 and GCC-10, you can link them with:

1
2
3
4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10

You can now use update-alternatives to set your default gcc and g++ to a more recent version:

1
2
update-alternatives --config g++
update-alternatives --config gcc
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# download clang
curl --output clang.tar.xz -L https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz
mkdir clang
tar -xvJf clang.tar.xz -C clang

# copy files to /usr/local
cd clang/clang+llvm-11.0.0-x86_64-apple-darwin
sudo cp -R * /usr/local/

# update default compiler
export CXX=/usr/local/bin/clang++

CMake 3.14+

Also check your CMake version is at least 3.14+:

1
cmake --version
1
cmake --version
1
cmake --version

If CMake is not installed or its version is older than CMake 3.14, update it with

1
sudo apt upgrade cmake

Alternatively, download the most recent version from cmake.org.

1
brew upgrade cmake

Homebrew

If this command fails because you don't have Homebrew on your computer, you can install it with

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

or you can follow the instructions in https://brew.sh.

Alternatively, download the most recent version from cmake.org.

Download the most recent version from cmake.org.

Gnuplot 5.2.6+

Install Gnuplot 5.2.6+ (Required at runtime)

1
2
sudo apt update
sudo apt install gnuplot

Or download the latest version from www.gnuplot.info. If you're using an installer, make sure you mark the option "Add application directory to your PATH environment variable".

1
brew install gnuplot

Or download the latest version from www.gnuplot.info. If you're using an installer, make sure you mark the option "Add application directory to your PATH environment variable".

Download Gnuplot from www.gnuplot.info and install it.

If you're using the Gnuplot installer, make sure you mark the option "Add application directory to your PATH environment variable"

Windows Gnuplot Terminals

If the Matplot++ examples don't display without console errors and gnuplot running, try to re-install Gnuplot with the wxt terminal.

Optional Dependencies

The build script will also look for these optional dependencies for manipulating images:

  • JPEG
  • TIFF
  • ZLIB
  • PNG
  • LAPACK
  • BLAS
  • FFTW
  • OpenCV

Embedded dependencies

There are two dependencies in source/3rd_party. These dependencies are bundled, so you don't have to worry about them:

  • olvb/nodesoup
  • dtschump/CImg

You can define MATPLOTPP_WITH_SYSTEM_NODESOUP=ON or MATPLOTPP_WITH_SYSTEM_CIMG=ON in the cmake command line to use a system-provided version of these dependencies.

OpenGL dependencies

There's an extra target matplot_opengl with the experimental OpenGL backend. You need to define MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON in the CMake command line to build that target. In that case, the build script will also look for these extra dependencies:

  • OpenGL
  • GLAD
  • GLFW3

If these dependencies are not found, the build script will download them. In any case, you can install these dependencies with:

1
sudo apt-get install libglfw3-dev

Download GLFW3 from https://www.glfw.org

Download GLFW3 from https://www.glfw.org

You can also see all dependencies in source/3rd_party/CMakeLists.txt.