I'm new to boost, I decided installing it by following instructions
provided at SO:
https://stackoverflow.com/a/24086375/10213771
(The only difference is that I used version 1.76)
Everything went fine, then I decided to compile this C++ file:
char const* greet(){
return "hello, world";}
#include
BOOST_PYTHON_MODULE(hello_ext){
using namespace boost::python;
def("greet", greet);}
Since boost.python is not header only library, I needed to link to it on
compilation, I used the following compile command:
g++ -I ~/Desktop/boost_1_76_0/ -I /usr/include/python2.7/ main.cpp -o prog
~/Desktop/boost_1_76_0/stage/lib/libboost_python27.a
but I get the following errors:
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in
function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld:
/home/sofiane/Desktop/boost_1_76_0/stage/lib/libboost_python27.a(registry.o):
in function `boost::python::converter::registration::get_class_object()
const':
...
/usr/bin/ld: function_doc_signature.cpp:(.text+0x1de): undefined reference
to `PyObject_IsTrue'
/usr/bin/ld: function_doc_signature.cpp:(.text+0x23e): undefined reference
to `PyInt_FromLong'
/usr/bin/ld: function_doc_signature.cpp:(.text+0x28b): undefined reference
to `PyInt_FromLong'
...