views:

61

answers:

2

Hi guys, really can't understand, how to build correctly project that uses boost.python. I've included boost_(python/thread/system)-mt. Here is simple module file:

#include <boost/python.hpp>
#include "script.hpp"
#include "boost/python/detail/wrap_python.hpp"

BOOST_PYTHON_MODULE(temp)
{
    namespace py = boost::python;

    py::def("PyLog", &engine::log);
}

Here is bulid log: http://dpaste.com/179232/. Can't imagine what I forgot.


System: arch linux;

ls /usr/lib |grep boost : http://dpaste.com/179233/

+1  A: 

You seem to be missing the headers from python itself.

The symbols such as PySequence_GetSlice and PyExc_ValueError are from the Python headers, not the boost::python headers.

That's all I can say, sorry. I don't really know boost::python. I'm surprised you don't have any error with "missing include file". I guess boost::python doesn't include the python headers itself?

btw, I saw the following on http://www.boost.org/doc/libs/1_42_0/libs/python/doc/building.html

Be sure not to #include any system headers before wrap_python.hpp. This restriction is actually imposed by Python, or more properly, by Python's interaction with your operating system. See http://docs.python.org/ext/simpleExample.html for details.

maybe that can help?

Kevin
Thank you for commenting, but It doesn't help for now. wrap_python.hpp is included after all another stuff. And python-headers are included too.
Ockonal
+2  A: 

That looks like a missing library in link phase. All those undefined references are included in the Python library. You probably just need to add something like "-lpython2.5" to your last gcc command.

WaHaa