Boost Python Issue

chris.felton at gmail.com chris.felton at gmail.com
Thu Aug 31 19:42:04 EDT 2006


I believe this is more of a tools/compiler issue than a coding issue.

If you are using the pre-built BOOST.Python library you get compile
mismatches.  I am not a Windows Visual Studio programmer (barely a
programmer), I am probably not using the correct terminology.

There are some settings for the threading type, debugging modes, etc.
If these don't match between you VC compilation and the BOOST library
complitation you can get those errors.

I had similar problems and it took me forever to figure it out.

Let me know if this helps, look at the command line from visual studio
and compare it to your command line from the Bjam build.

JDJMSon wrote:
> I was wondering if someone here could help me with a problem I'm having
> building Python extensions with the Boost.Python library.
> Basically, if I have a wrapper class with something like this:
>
> string TestFunc()
> {
> 	return "Hello World";
> }
>
> BOOST_PYTHON_MODULE(TestClass)
> {
> 	def("TestFunc",TestFunc);
> }
>
>
> It compiles and I can use it without a problem. However, when I try to
> wrap a class with code like this:
>
> class TestClass
> {
> public:
> 	TestClass() {};
> 	~TestClass() {};
> 	string TestFunction(){return "Hello World";};
> };
>
> BOOST_PYTHON_MODULE(TestClass)
> {
> 	class_<TestClass>("TestClass")
> 		.def("TestFunction",&TestClass.TestFunction)
> 	;
> }
>
>
> I get the following error:
> vc-C++
> bin\PythonTest\TestClass.pyd\vc-8_0\debug\threading-multi\TestClass.obj
> TestClass.cpp
> TestClass.cpp(27) : error C2976: 'boost::python::class_' : too few
> template arguments
>
> c:\Development\Boost\boost_1_33_1\boost/python/def_visitor.hpp(14) :
> see declaration of 'boost::python::class_'
> TestClass.cpp(27) : error C2440: '<function-style-cast>' : cannot
> convert from 'const char [10]' to 'boost::python::class_'
>         Source or target has incomplete type
>
> I'm using Visual Studio 2005 Express Edition (I get the same error with
> 2003 Professional), and am using bJam to build the extension.
> 
> Does anyone have any idea what's causing this?




More information about the Python-list mailing list