Matplot++

Build & Install

My enviroment:

  • Architecture: x86_64

  • OS: Ubuntu 22.04 LTS

  • Editor: VS Code 1.71.0

  • Compiler: gcc 11.2.0

  • Build Tool: CMake 3.22.1

First install dependenciesarrow-up-right what you need.

Download the source code from GitHub Releasesarrow-up-right. Choose Source code(tar.gz).

Use lscpu to see how many cores on your machine, mine is 12, so I replaced 2 by 12:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF 
sudo cmake --build . --parallel 12 --config Release
sudo cmake --install .

Path to installation:

  • headers: /usr/local/include

  • libs: /usr/local/lib

Add "/usr/local/include" to your includePath in VS Code to support IntelliSense for cross-compilingarrow-up-right. Then you can add this header to your source files:

Find as External Package with CMake

A simple example, here example.cpp and the CMakeLists.txt are in the same directory:

You can find C++ examplesarrow-up-right and details about this CMakeLists.txtarrow-up-right in the documentation.

Last updated