matplotlib-cpp
matplotlib-cpp copied to clipboard
Problems on mac
Include error
Firstly I met two errors, they are:
./../matplotlibcpp.h:5:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
and
./../matplotlibcpp.h:20:12: fatal error: 'numpy/arrayobject.h' file not found
# include <numpy/arrayobject.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
Then after hard research, I changed their include path and it worked!
After changing:
line 5:
#include </System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h>
line 20:
#include </System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/numpy/arrayobject.h>
Redefinition error
On my MacBook, I met another trouble as well, they are:
./../matplotlibcpp.h:353:37: warning: static_assert with no message is a C++17 extension [-Wc++17-extensions]
static_assert(sizeof(long long) == 8);
^
, ""
./../matplotlibcpp.h:354:20: error: redefinition of 'select_npy_type<long long>'
template <> struct select_npy_type<long long> { const static NPY_TYPES type = NPY_INT64; };
^~~~~~~~~~~~~~~~~~~~~~~~~~
./../matplotlibcpp.h:345:20: note: previous definition is here
template <> struct select_npy_type<int64_t> { const static NPY_TYPES type = NPY_INT64; };
^
./../matplotlibcpp.h:355:46: warning: static_assert with no message is a C++17 extension [-Wc++17-extensions]
static_assert(sizeof(unsigned long long) == 8);
^
, ""
./../matplotlibcpp.h:356:20: error: redefinition of 'select_npy_type<unsigned long long>'
template <> struct select_npy_type<unsigned long long> { const static NPY_TYPES type = NPY_UINT64; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../matplotlibcpp.h:349:20: note: previous definition is here
template <> struct select_npy_type<uint64_t> { const static NPY_TYPES type = NPY_UINT64; };
^
2 warnings and 2 errors generated.
And after I commented out line 353 to line 356, it worked fine!!!