Skip to content

Python Boost Library #25

Answered by MarkusJx
jonassorgenfrei asked this question in Q&A
Oct 30, 2022 · 3 comments · 10 replies

You must be logged in to vote

Apparently, the boost python libraries work in a weird way, so that's good to know.

I've tried compiling your project locally and found this stackoverflow answer. So for some reason, when using boost static libraries, you have to define BOOST_PYTHON_STATIC_LIB before including boost/python.hpp. So I've added this to your project and it compiles.

Thus, I present you two options solving your issue:

  1. Define BOOST_PYTHON_STATIC_LIB in your myClass.cpp before including boost/python.hpp:
#define BOOST_PYTHON_STATIC_LIB
#include <boost/python.hpp>
  1. (Probably more elegant) If you don't want to change your local setup, which you probably don't want to do, just add this to your CMakeLists.txt:
# …

Replies: 3 comments 10 replies

You must be logged in to vote
0 replies

You must be logged in to vote
0 replies

You must be logged in to vote
10 replies
@MarkusJx

@jonassorgenfrei

@MarkusJx

@jonassorgenfrei

@jonassorgenfrei

Answer selected by jonassorgenfrei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants