matplotlib-cpp icon indicating copy to clipboard operation
matplotlib-cpp copied to clipboard

Error in 1st example

Open dgaul opened this issue 3 years ago • 1 comments

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

dgaul avatar May 25 '22 13:05 dgaul

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

cvampal avatar Jun 15 '22 16:06 cvampal