I am using Windows XP and have successfully build the Boost libraries, plus boost_python.dll. I am trying to work through the C API tutorial where the file hello.cpp is found at libs/python/example/tutorial. I have been able to compile and execute the first example building the supplied hello.cpp file that allows Python to import a C function, but when I move onto the next example in the tutorial:
struct World { void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE(hello) { class_<World>("World") .def("greet", &World::greet) .def("set", &World::set) ; } I replace the original contents of hello.cpp with the above code and using bjam tried to build hello.pyd. I receive the following errors: ...found 1513 targets... ...updating 4 targets... vc-C++ bin\tutorial\hello.pyd\vc-8_0\debug\threading-multi\hello.obj hello.cpp hello.cpp(22) : error C2976: 'boost::python::class_' : too few template arguments G:\boost_1_33_1\boost/python/def_visitor.hpp(14) : see declaration of 'boost::python::class_' hello.cpp(22) : error C2440: '<function-style-cast>' : cannot convert from 'const char [6]' to 'boost::python::class_' Source or target has incomplete type hello.cpp(22) : error C2228: left of '.def' must have class/struct/union hello.cpp(22) : error C2228: left of '.def' must have class/struct/union hello.cpp(22) : error C2143: syntax error : missing ';' before '}' CALL "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.BAT" >nul "C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl" /Zm800 -nologo /EHsc -c -DBOOST_PYTHON_DYNAMIC_LIB /Z7 /Od /Ob0 /EHsc /GR /MDd /Zc:forScope /Zc:wchar_t -I"bin\tutorial" -I"G:\boost_1_33_1" -I"c:\Python25\include" -Fo"bin\tutorial\hello.pyd\vc-8_0\debug\threading-multi\hello.obj" -Tp"hello.cpp" ...failed vc-C++ bin\tutorial\hello.pyd\vc-8_0\debug\threading-multi\hello.obj... ...skipped <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.CMD for lack of <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.obj... ...skipped <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.pyd for lack of <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.CMD... ...skipped <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.lib for lack of <@tutorial\hello.pyd\vc-8_0\debug\threading-multi>hello.CMD... ...failed updating 1 target... ...skipped 3 targets... I reviewed the definition of class_ in file def_visitor.hpp and found that it was defined as: template<T1, X1, X2, X3> class class_; I have tried searching the FAQ and the Web and so far no luck. I would appreciate any help. Arthur
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor