[C++-sig] Embedding Python with Boost

Ron Brown, Jr. rbrown at gamry.com
Mon Apr 2 23:59:00 CEST 2007


Greetings,

I've been having a bit of trouble in making a simple embedded python 
application using boost, and am in need of some guidance.  Hopefully I'm 
in the right place.  All I'm trying to do is just fit the basic pieces 
together to see if embedding python is a viable solution for my next 
project.

I'm on Windows using mingw tools, specifically:
g++ (GCC) 3.4.2 (mingw-special)
Boost 1.33.1
Python 2.5

I was able to build Boost after minimal problems, mostly from setting up 
my environment for Boost.Jam.  All of the examples, including the 
embedding.cpp example, seem to all compile/link just fine, and I'm able 
to import the example Python extensions and use them.

My problem lies in getting the most basic embedded Python application 
(see below) to link.

I'm trying to link my simple app here with boost_python.lib and 
python25.lib.  When I try to link, I'm getting:
C:/Boost/boost_1_33_1/boost/python/cast.hpp: undefined reference to 
`_imp___Py_NoneStruct'


Am I barking up the wrong tree by trying to statically link those libs?

Any advice that anyone could give would be greatly appreciated.  Thanks 
in advance,

-Ron


------------------------------
#include <boost/python.hpp>

int main()
{
	Py_Initialize();
	Py_Finalize();
	
	return 0;
}
------------------------------




More information about the Cplusplus-sig mailing list