lava / matplotlib-cpp

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

Using the plt::contour() function leads to a compilation error: ‘get_array’ was not declared in this scope #234

Closed shyney7 closed 2 years ago

shyney7 commented 3 years ago

I would like to use a contour map for plotting a compressor map but unfortunately I'm not able to use the plt::contour() function since the following error occurs:

In file included from ../main.cpp:2:0:
../include/matplotlibcpp.h: In instantiation of ‘bool matplotlibcpp::contour(const std::vector<Numeric>&, const std::vector<NumericY>&, const std::vector<XType>&, const std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&) [with NumericX = std::vector<double>; NumericY = std::vector<double>; NumericZ = std::vector<double>]’:
../main.cpp:211:37:   required from here
../include/matplotlibcpp.h:1142:33: error: ‘get_array’ was not declared in this scope
     PyObject* xarray = get_array(x);
                        ~~~~~~~~~^~~
../include/matplotlibcpp.h:1142:33: note: suggested alternative:
In file included from ../main.cpp:2:0:
../include/matplotlibcpp.h:403:19: note:   ‘matplotlibcpp::detail::get_array’
 inline PyObject * get_array(const std::vector<std::string>& strings)
                   ^~~~~~~~~
In file included from ../main.cpp:2:0:
../include/matplotlibcpp.h:1143:33: error: ‘get_array’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     PyObject* yarray = get_array(y);
                        ~~~~~~~~~^~~
../include/matplotlibcpp.h:1142:33: note: ‘get_array’ declared here, later in the translation unit
     PyObject* xarray = get_array(x);
                        ~~~~~~~~~^~~
../include/matplotlibcpp.h:1144:33: error: ‘get_array’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     PyObject* zarray = get_array(z);
                        ~~~~~~~~~^~~
../include/matplotlibcpp.h:1142:33: note: ‘get_array’ declared here, later in the translation unit
     PyObject* xarray = get_array(x);
                        ~~~~~~~~~^~~

I use the python 3.6 flags because since the newest commit I cant use python 2.7 anymore because I get the following compiler error: cannot convert ‘wchar_t**’ to ‘char**’ like in this issue #225

mattivahs commented 3 years ago

Hey, I have a similar problem. Did you solve this issue?

shyney7 commented 3 years ago

Hey, I have a similar problem. Did you solve this issue?

@mattivahs Unfortunately not. Maybe @JBPennington can help here since the contour feature was made by him with this pull request #181

Maybe its also possible to use the version from @Cryoris from his pull request #190

mattivahs commented 3 years ago

@shyney7 I used the version from @Cryoris and it works well!

shyney7 commented 3 years ago

@mattivahs thx for reporting. Did you just use his fork? Maybe you can also upvote his pull request #190 so that it gets implemented in this repo? Thank you

shyney7 commented 2 years ago

This issue was fixed by merging pull request #190 !