Hi all,<br>I&#39;m trying to compile a small module using boost python which is like this:<br><br>/* File : test.cpp */<br>#include &lt;boost/python.hpp&gt;<br>#include &lt;string&gt;<br>using namespace boost::python;<br><br>
class Test<br>{<br>public:<br>    std::string test() { return &quot;Test passed.&quot;; };<br>};<br><br>BOOST_PYTHON_MODULE(test)<br>{<br>    class_&lt;Test&gt;(&quot;Test&quot;)<br>        .def(&quot;test&quot;, &amp;Test::test)<br>
    ;<br>}<br><br><br>And the CMakeLists.txt is:<br><br># Test for cmake version (not required)<br>cmake_minimum_required (VERSION 2.6)<br><br># Name of project<br>project (Test)<br><br># Find library locations using convenient cmake search functions<br>
include (FindBoost)<br>include (FindPythonLibs)<br><br># Include library include directories (where the header files for python and boost python are)<br>include_directories (${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH})<br>
<br># Add module target (basically tells cmake to build test.cpp as a python module)<br>add_library (test MODULE test.cpp)<br><br># Link to boost libraries<br>target_link_libraries (test<br>    ${Boost_LIBRARIES}<br>    ${PYTHON_LIBRARIES}<br>
    )<br><br>Running cmake with the command cmake -G &quot;MinGW Makefiles&quot; gives the following result:<br>-- The C compiler identification is GNU<br>-- The CXX compiler identification is GNU<br>-- Check for working C compiler: C:/MinGW/bin/gcc.exe<br>
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: C:/MinGW/bin/g++.exe<br>-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works<br>
-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Boost version: 1.39.0<br>-- Found the following Boost libraries:<br>-- Found PythonLibs: C:/Python25/libs/libpython25.a<br>-- Configuring done<br>
-- Generating done<br>-- Build files have been written to: C:/Documents and Settings/Nazia/Desktop/example_cpp_module<br><br>But the &#39;mingw32-make&#39; command to make the shared module fails with the following error:<br>
<br>Scanning dependencies of target test<br>[100%] Building CXX object CMakeFiles/test.dir/test.cpp.obj<br>Linking CXX shared module libtest.dll<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text+0x11e): undefined reference<br>
to `_imp___ZN5boost6python6detail11init_moduleEPKcPFvvE&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python3defIPFPKcvE<br>EEvS3_T_[void boost::python::def&lt;char const* (*)()&gt;(char const*, char const* (*)<br>
())]+0x6e): undefined reference to `_imp___ZN5boost6python6detail17scope_setattr<br>_docEPKcRKNS0_3api6objectES3_&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python6detail17mak<br>e_function_auxIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS4_EEEENS0_3ap<br>
i6objectET_RKT0_RKT1_[boost::python::api::object boost::python::detail::make_fun<br>ction_aux&lt;char const* (*)(), boost::python::default_call_policies, boost::mpl::v<br>ector1&lt;char const*&gt; &gt;(char const* (*)(), boost::python::default_call_policies co<br>
nst&amp;, boost::mpl::vector1&lt;char const*&gt; const&amp;)]+0x73): undefined reference to `_<br>imp___ZN5boost6python7objects15function_objectERKNS1_11py_functionE&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python7objects21py<br>
_function_impl_baseC2Ev[boost::python::objects::py_function_impl_base::py_functi<br>on_impl_base()]+0x7): undefined reference to `_imp___ZTVN5boost6python7objects21<br>py_function_impl_baseE&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.rdata$_ZTVN5boost6python7objects2<br>
3caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesEN<br>S_3mpl7vector1IS6_EEEEEE[vtable for boost::python::objects::caller_py_function_i<br>mpl&lt;boost::python::detail::caller&lt;char const* (*)(), boost::python::default_call<br>
_policies, boost::mpl::vector1&lt;char const*&gt; &gt; &gt;]+0x18): undefined reference to `<br>boost::python::objects::py_function_impl_base::max_arity() const&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python7objects23ca<br>
ller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3<br>mpl7vector1IS6_EEEEED1Ev[boost::python::objects::caller_py_function_impl&lt;boost::<br>python::detail::caller&lt;char const* (*)(), boost::python::default_call_policies,<br>
boost::mpl::vector1&lt;char const*&gt; &gt; &gt;::~caller_py_function_impl()]+0x16): undefin<br>ed reference to `_imp___ZN5boost6python7objects21py_function_impl_baseD2Ev&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python7objects23ca<br>
ller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3<br>mpl7vector1IS6_EEEEED0Ev[boost::python::objects::caller_py_function_impl&lt;boost::<br>python::detail::caller&lt;char const* (*)(), boost::python::default_call_policies,<br>
boost::mpl::vector1&lt;char const*&gt; &gt; &gt;::~caller_py_function_impl()]+0x16): undefin<br>ed reference to `_imp___ZN5boost6python7objects21py_function_impl_baseD2Ev&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZNK5boost6python9type_info4<br>
nameEv[boost::python::type_info::name() const]+0x15): undefined reference to `_i<br>mp___ZN5boost6python6detail12gcc_demangleEPKc&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZNK5boost6python15to_python<br>_valueIRKPKcEclES5_[boost::python::to_python_value&lt;char const* const&amp;&gt;::operator<br>
()(char const* const&amp;) const]+0xf): undefined reference to `_imp___ZN5boost6pyth<br>on9converter19do_return_to_pythonEPKc&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python9converter23<br>expected_pytype_for_argIPKcE10get_pytypeEv[boost::python::converter::expected_py<br>
type_for_arg&lt;char const*&gt;::get_pytype()]+0x24): undefined reference to `_imp___Z<br>N5boost6python9converter8registry5queryENS0_9type_infoE&#39;<br>CMakeFiles\test.dir\test.cpp.obj:test.cpp:(.text$_ZN5boost6python9converter23<br>
expected_pytype_for_argIPKcE10get_pytypeEv[boost::python::converter::expected_py<br>type_for_arg&lt;char const*&gt;::get_pytype()]+0x3a): undefined reference to `_imp___Z<br>NK5boost6python9converter12registration25expected_from_python_typeEv&#39;<br>
collect2: ld returned 1 exit status<br>mingw32-make[2]: *** [libtest.dll] Error 1<br>mingw32-make[1]: *** [CMakeFiles/test.dir/all] Error 2<br>mingw32-make: *** [all] Error 2<br><br>I&#39;ve no idea how to fix this and really need your help. Can anyone help me out?<br>
<br>Regards,<br>Nazia Zaman<br>