[ACCEPTED]-No such file or directory" error with Boost Python-boost
add #include <Python.h>
and compile with -I/usr/include/python2.6
or whatever your 2 Python version is.
Do not forget to link 1 it with -lpython2.6 -lboost_python
Although it's quite late, but still, here's 3 my answer:
Make sure you have the libboost-python-dev 2 libraries installed:
sudo apt-get install libboost-python-dev
This did the trick for 1 me.
It looks like you are missing the Python 6 headers (Python.h etc.). Make sure you insteall 5 the -devel or -dev package for your version 4 of Python through the operating system package 3 manager. This should provide the header 2 files...
[Edit: noticed you are on ubuntu 1 so try sudo aptitude install python-dev
]
Building a big program by executing individual 6 commands like that can quickly get very 5 complicated. You can use a build system 4 like CMake to find the dependencies and sort 3 out the compiler commands for you.
The minimal 2 CMakeLists.txt
to use CMake with a boost python project 1 is this:
project (MyProject)
cmake_minimum_required(VERSION 2.8)
find_package(PythonLibs)
include_directories (${PYTHON_INCLUDE_DIRS})
find_package(Boost 1.45.0 COMPONENTS python)
include_directories (${Boost_INCLUDE_DIRS})
add_library (
mylibinterface SHARED
mylib.cpp
)
target_link_libraries (mylibinterface
boost_python
${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
)
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.