This post describes how to configure Eclipse under linux to create Boost.python c++ shared library. I suppose you have Boost and Eclipse Indigo already installed.
First step is to chose File -> New -> C++ project. Then select 'shared library' -> empty project. Name it somehow and finish. Now click Project -> properties, expand C/C++ Build and chose Settings. In GCC C++ compiler click on dictionaries and add /usr/include/boost and /usr/include/python. That paths are correct for me, for You they might be different...
Next step is to change dynamic library name. It must be the same as your BOOST_PYTHON_MODULE(<its name>). So if your module is called 'hello' then your configuration looks like
Next thing is to add -fPIC flag to your compiler settings
Now your library will compile, but You have to add boost_python library to Your linker settings.
You are ready to build library now and import it in python using 'import hello' statement.
No comments:
Post a Comment