[C++-sig] Need help with simple boost embedded python program

Thomas Berg merlin66b at gmail.com
Thu Jul 22 15:06:24 CEST 2010


On Thu, Jul 22, 2010 at 3:02 AM, Kiramin (Subscriptions)
<mk.subscribe at gmail.com> wrote:
> I can't seem to get this to work:
> This little program just embeds python, creates a module using boost, and
> attempts to add it to the list of built-in modules.
> //-------------------------------------------------------
> #include <boost/python.hpp>
> using namespace boost::python;
> char const* greet()
> {
>    return "hello, world";
> }
> BOOST_PYTHON_MODULE(hello)
> {
>     def("greet", greet);
> }
> int main()
> {
> PyImport_AppendInittab("hello", inithello);
> Py_Initialize();
> return 0;
> }
> //-------------------------------------------------------
> But when I attempt to build using bjam, I get:
> -------------------------------------------------------
> ...found 1629 targets...
> ...updating 3 targets...
> compile-c-c++ bin\msvc-10.0\debug\threading-multi\BoostPy3DEngine.obj
> BoostPy3DEngine.cpp
> BoostPy3DEngine.cpp(17) : error C2065: 'inithello' : undeclared identifier
>     call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
[...]
> Anyone know what might be causing the above error?
> Thanks for any help you can give!
> -Mike

FWIW, your code builds just fine here, with Visual Studio 8.0 and
boost 1.43. Maybe it's a Visual Studio 10.0 specific problem? Also, I
do not use bjam. Your code looks fine at least.

Thomas


More information about the Cplusplus-sig mailing list