title: Linking error with Boost.python while compiling
body: <p>Am trying to build the example inspired from <a href="https://www.boost.org/doc/libs/1_71_0/libs/python/doc/html/article.htm" rel="nofollow noreferrer">here</a></p>
  
  <p>My original intention is to be able to call C++ code from within Python. I'm just running the examples from the Boost documentation in order to achieve this goal. </p>
  
  <p>Here's my makefile</p>
  
  <pre><code>CXX               := g++
  CXX_FLAGS         := -Wall -Wextra -std=c++17 -ggdb
  
  BIN               := bin
  SRC               := src
  INCLUDE           := inc
  LIB               := lib
  
  BOOST_ROOT        := /home/eicossa/repo/boost_install
  BOOST_INCL        := ${BOOST_ROOT}/include/
  BOOST_LIBS        := ${BOOST_ROOT}/libs/ 
  
  PYTHON_INCL       := /usr/include/python3.7m/
  PYTHON_LIBS       := /usr/lib/python3.7/
  
  LIBFLAGS          := -lboost_system 
  EXECUTABLE        := greet
  
  
  all: $(BIN)/$(EXECUTABLE)
  
  run: clean all
          clear
          ./$(BIN)/$(EXECUTABLE)
  
  $(BIN)/$(EXECUTABLE): $(SRC)/*.cpp 
          $(CXX) $(CXX_FLAGS) -I$(PYTHON_INCL) -I$(INCLUDE) -I$(BOOST_INCL) -L$(BOOST_LIBS) -L$(PYTHON_LIBS) -L$(LIB$
  
  clean:
          -rm $(BIN)/*
  </code></pre>
  
  <p>This leads to the following errors</p>
  
  <blockquote>
    <p>/tmp/ccNVjFX3.o: In function <code>boost::python::api::object::object()':
    /home/eicossa/repo/boost_install/include/boost/python/object_core.hpp:400:
    undefined reference to</code>_Py_NoneStruct' /tmp/ccQNpbxG.o: In function
    <code>PyInit_hello_ext':
    /home/eicossa/Dropbox/wtcd/license/boost/src/bindings.cpp:3: undefined
    reference to</code>boost::python::detail::init_module(PyModuleDef&amp;, void
    (<em>)())' /tmp/ccQNpbxG.o: In function <code>boost::python::type_info::name()
    const':
    /home/eicossa/repo/boost_install/include/boost/python/type_id.hpp:160:
    undefined reference to</code>boost::python::detail::gcc_demangle(char
    const</em>)' /tmp/ccQNpbxG.o: In function
    <code>boost::python::to_python_value&lt;char const* const&amp;&gt;::operator()(char
    const* const&amp;) const':
    /home/eicossa/repo/boost_install/include/boost/python/converter/builtin_converters.hpp:157:
    undefined reference to
    </code>boost::python::converter::do_return_to_python(char const*)'
    /tmp/ccQNpbxG.o: In function <code>boost::python::to_python_value&lt;char
    const* const&amp;&gt;::get_pytype() const':
    /home/eicossa/repo/boost_install/include/boost/python/converter/builtin_converters.hpp:157:
    undefined reference to</code>PyUnicode_Type' /tmp/ccQNpbxG.o: In function
    <code>void boost::python::def&lt;char const* (*)()&gt;(char const*, char const*
    (*)())':
    /home/eicossa/repo/boost_install/include/boost/python/def.hpp:91:
    undefined reference to</code>boost::python::detail::scope_setattr_doc(char
    const*, boost::python::api::object const&amp;, char const*)'
    /tmp/ccQNpbxG.o: In function `boost::python::api::object
    boost::python::detail::make_function_aux</p>
    
    <blockquote>
      <p>(char const* (*)(), boost::python::default_call_policies const&amp;, boost::mpl::vector1 const&amp;)':
      /home/eicossa/repo/boost_install/include/boost/python/make_function.hpp:38:
      undefined reference to
      <code>boost::python::objects::function_object(boost::python::objects::py_function
      const&amp;)' /tmp/ccQNpbxG.o: In function
      </code>boost::python::objects::py_function_impl_base::py_function_impl_base()':
      /home/eicossa/repo/boost_install/include/boost/python/object/py_function.hpp:20:
      undefined reference to <code>vtable for
      boost::python::objects::py_function_impl_base'
      /tmp/ccQNpbxG.o:(.rodata._ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEEE[_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEEE]+0x30):
      undefined reference to
      </code>boost::python::objects::py_function_impl_base::max_arity() const'
      /tmp/ccQNpbxG.o: In function
      <code>boost::python::objects::caller_py_function_impl&lt;boost::python::detail::caller&lt;char
      const* (*)(), boost::python::default_call_policies,
      boost::mpl::vector1&lt;char const*&gt; &gt; &gt;::~caller_py_function_impl()':
      /home/eicossa/repo/boost_install/include/boost/python/object/py_function.hpp:30:
      undefined reference to
      </code>boost::python::objects::py_function_impl_base::~py_function_impl_base()'
      /tmp/ccQNpbxG.o:(.rodata._ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEEE[_ZTIN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEEE]+0x10):
      undefined reference to <code>typeinfo for
      boost::python::objects::py_function_impl_base' /tmp/ccQNpbxG.o: In
      function</code>boost::python::converter::expected_pytype_for_arg::get_pytype()':
      /home/eicossa/repo/boost_install/include/boost/python/converter/pytype_function.hpp:69:
      undefined reference to
      <code>boost::python::converter::registry::query(boost::python::type_info)'
      /home/eicossa/repo/boost_install/include/boost/python/converter/pytype_function.hpp:70:
      undefined reference to
      </code>boost::python::converter::registration::expected_from_python_type()
      const' collect2: error: ld returned 1 exit status Makefile:27: recipe
      for target 'bin/greet' failed make: *** [bin/greet] Error 1</p>
    </blockquote>
  </blockquote>
  
  <p>What am i doing wrong ?</p>