<div>I can't seem to get this to work:</div><div>This little program just embeds python, creates a module using boost, and attempts to add it to the list of built-in modules.</div><div><br></div><div>//-------------------------------------------------------</div>
<div>#include <boost/python.hpp></div><div>using namespace boost::python;</div><div><br></div><div>char const* greet()</div><div>{</div><div> return "hello, world";</div><div>}</div><div><br></div><div>BOOST_PYTHON_MODULE(hello)</div>
<div>{</div><div> def("greet", greet);</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>PyImport_AppendInittab("hello", inithello);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>Py_Initialize();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return 0;</div><div>}</div><div>//-------------------------------------------------------</div>
<div><br></div><div>But when I attempt to build using bjam, I get:</div><div><br></div><div>-------------------------------------------------------<br><div>...found 1629 targets...</div><div>...updating 3 targets...</div>
</div><div><div>compile-c-c++ bin\msvc-10.0\debug\threading-multi\BoostPy3DEngine.obj</div><div>BoostPy3DEngine.cpp</div><div>BoostPy3DEngine.cpp(17) : error C2065: 'inithello' : undeclared identifier</div></div><div>
<div><br></div><div> call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul</div><div>cl /Zm800 -nologo @"bin\msvc-10.0\debug\threading-multi\BoostPy3DEngine.obj.rsp"</div>
<div><br></div><div>...failed compile-c-c++ bin\msvc-10.0\debug\threading-multi\BoostPy3DEngine.obj...</div><div>...skipped <pbin\msvc-10.0\debug\threading-multi>BoostPy3DEngine.exe for lack of</div><div> <pbin\msvc-10.0\debug\threading-multi>BoostPy3DEngine.obj...</div>
<div>...skipped <pbin\msvc-10.0\debug\threading-multi>BoostPy3DEngine.pdb for lack of</div><div> <pbin\msvc-10.0\debug\threading-multi>BoostPy3DEngine.obj...</div><div>...failed updating 1 target...</div><div>
...skipped 2 targets...</div></div><div>-------------------------------------------------------</div><div><br></div><div>My understanding is that the BOOST_PYTHON_MODULE macro is supposed to create the inithello function when it builds the hello module... but the compiler doesn't seem to be able to find it.</div>
<div><div><br></div><div>The above code compiles without complaint if I leave out the line:</div><div>PyImport_AppendInittab("hello", inithello);</div></div><div><br></div><div>I am using bjam with the --toolset=msvc switch (its the only way I know how to build with boost). And I have MSVC version 10.0.30319.1 installed, and this is a Windows XP machine.</div>
<div><br></div><div><div>Anyone know what might be causing the above error?</div></div><div><br></div><div>Thanks for any help you can give!</div><div><br></div><div>-Mike</div>