lava / matplotlib-cpp

Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
MIT License
4.37k stars 1.13k forks source link

Error in 1st example #312

Open dgaul opened 2 years ago

dgaul commented 2 years ago

When I run the standard minimal example

#include "inc/matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
    plt::plot({1,3,2,4});
    plt::show();
}

I receive a memory access error. Output: the plot shows up and I receive the error message "Memory access error (memory dump written)".

Screenshot_20220525_150026

I compiled the program using

g++ -std=c++11 -W -o test test.cpp -I/home/username/anaconda3/include/python3.7m/ -I/home/username/anaconda3/lib/python3.7/site-packages/numpy/core/include -L/home/username/anaconda3/lib/ -lpython3.7m

as described in the docs

cvampal commented 2 years ago

You are not including the dynamic library for python. g++ -std=c++11 -Wall -o test test.cpp -I /usr/include/python3.10 -I /home/ai/.local/lib/python3.10/site-packages/numpy/core/include /usr/lib/x86_64-linux-gnu/libpython3.10.so