Thursday, February 11, 2010

BOOST_PYTHON_STATIC_LIB vs BOOST_PYTHON_DYNAMIC_LIB

I have a pretty bad habit of changing things in one configuration and then not replicating the results in the others, so this morning while trying to compile in release I ran into a bunch of issues. Most were pretty easily solved, but then I ran into a linker error that I had solved yesterday, it took me a couple of minutes of comparing settings from configuration to configuration to figure it out but then I remembered. In my precompiled header I was getting these linker errors earlier yesterday:

1>precompiled.obj : error LNK2001: unresolved external symbol "private: static bool volatile boost::python::docstring_options::show_py_signatures_" (?show_py_signatures_@docstring_options@python@boost@@0_NC)
1>precompiled.obj : error LNK2001: unresolved external symbol "private: static bool volatile boost::python::docstring_options::show_user_defined_" (?show_user_defined_@docstring_options@python@boost@@0_NC)
1>precompiled.obj : error LNK2001: unresolved external symbol "private: static bool volatile boost::python::docstring_options::show_cpp_signatures_" (?show_cpp_signatures_@docstring_options@python@boost@@0_NC)


Web searches haven't been much help to explain why this is, and maybe I just don't know enough about boost to understand it, but the solution to this error is to change your preprocesser defines.

Previously I was using
BOOST_PYTHON_DYNAMIC_LIB
in my preprocessor defines, it works fine for everything else I've done, but something in my new project doesn't like it. The solution to this is to tell boost to static link instead by using
BOOST_PYTHON_STATIC_LIB
instead of
BOOST_PYTHON_DYNAMIC_LIB
.

When I have some more time I'm going to look into this a little bit more, I'd personally just like an explanation as to why I need to do this.

No comments:

Post a Comment