[C++-sig] Embedding Python with Boost

David Abrahams dave at boost-consulting.com
Sat Apr 7 20:38:43 CEST 2007


on Tue Apr 03 2007, "Ron Brown, Jr." <rbrown-AT-gamry.com> wrote:

> Roman Yakovenko wrote:
>> I suggest you to try other Boost version.  Recently there were some 
>> post, where David Abrahams said build system was broken on this platform.
>
> Really?  I'll certainly have to look into that.

Yeah, really?  that's news to me.  It's especially surprising to hear
you say that because Ron says he was successful getting all the
examples to work.

> That's the most likely thing.  I've had some progress, and am able to 
> get that example I posted to compile, link, and run, but that's 
> essentially just using the Python C API.  Now that I'm trying to 
> actually use Boost (the examples in this tutorial: 
> http://members.gamedev.net/sicrane/articles/EmbeddingPythonPart1.html), 
> I'm running into all kinds of problems during linking.
>
> Here is my Jamfile:
>
> --------------------
> project-root ;
>
> import python ;
>
> exe embedtest # name of the executable
>    : #sources
> 	embedtest.cpp
>    : # requirements
> 	<library-file>c:/boost/boost_1_33_1/libs/python/build/bin-stage/boost_python.lib
>    $(PYTHON_PROPERTIES)
> 	<define>BOOST_PYTHON_STATIC_LIB
> 	<define>BOOST_PYTHON_STATIC_MODULE
> 	<library-path>$(PYTHON_LIB_PATH)
> 	<find-library>$(PYTHON_EMBEDDED_LIBRARY) ;
> --------------------

At least one problem is that you're linking with an import library for
boost.python but adding the
#defines for a static lib, which would be named libboost_python.lib.
                                                ^^^

see http://www.boost.org/more/getting_started.html#Results

This all gets a lot easier with BBv2, fortunately.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Don't Miss BoostCon 2007! ==> http://www.boostcon.com




More information about the Cplusplus-sig mailing list