Skip to content

error: redefinition of 'select_npy_type<long long>' #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TheInfamousWayne opened this issue Jun 2, 2020 · 8 comments
Open

error: redefinition of 'select_npy_type<long long>' #196

TheInfamousWayne opened this issue Jun 2, 2020 · 8 comments

Comments

@TheInfamousWayne
Copy link

/Users/vagrawal/new/object_pose/include/matplotlibcpp.hpp:306:20: error: redefinition of 'select_npy_type<long long>'
template <> struct select_npy_type<long long> { const static NPY_TYPES type = NPY_INT64; };
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vagrawal/new/object_pose/include/matplotlibcpp.hpp:297:20: note: previous definition is here
template <> struct select_npy_type<int64_t> { const static NPY_TYPES type = NPY_INT64; };
                   ^
/Users/vagrawal/new/object_pose/include/matplotlibcpp.hpp:307:46: warning: static_assert with no message is a C++17 extension [-Wc++17-extensions]
static_assert(sizeof(unsigned long long) == 8);
                                             ^
                                             , ""
/Users/vagrawal/new/object_pose/include/matplotlibcpp.hpp:308: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; };
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vagrawal/new/object_pose/include/matplotlibcpp.hpp:301:20: note: previous definition is here
template <> struct select_npy_type<uint64_t> { const static NPY_TYPES type = NPY_UINT64; };
                   ^

I'm using cmake for building. I'm working on macOS Catalina. Do you have suggestions to fix this?

@TheInfamousWayne
Copy link
Author

if I comment out those lines and run a simple

plt::plot({1,3,2,4});
plt::show();

I get this error:
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Error loading module matplotlib.pyplot!

@Cryoris
Copy link
Contributor

Cryoris commented Jun 3, 2020

You need to uncomment a few lines, as noted in the code here:

// Sanity checks; comment them out or change the numpy type below if you're compiling on

(I'm running on Catalina, too)

@kernbeisser
Copy link

works for me (macos catalina)

@Ujjwalkanth
Copy link

Hello,
I had the similar problem, but after commenting out the lines in matplotlibcpp.h. I am getting an error saying

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find : No such file or directory
collect2.exe: error: ld returned 1 exit status

Any suggestions?
Thank you.

@colonelwatch
Copy link

Also had this issue in mingw_w64, and commenting out those lines fixed it.

@linzhuyue
Copy link

@Cryoris Thx, this works for me.

@WildRackoon
Copy link

WildRackoon commented Jan 16, 2023

Those asserts should simply be removed since those (long long and unsigned long long) are type aliases of fixed size types ?

jonathanloganmoran added a commit to jonathanloganmoran/ND0013-Self-Driving-Car-Engineer that referenced this issue Jan 22, 2023
Fixes the `error: redefinition` thrown by the `typedef` on line 354 / line 356. Reference to issue here: lava/matplotlib-cpp#196
@dograt
Copy link

dograt commented Dec 3, 2023

I'm getting this error with a vcpkg installation of the library with the latest MSVC. Is it possible to update the port so that this no longer occurs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants