2009-11-20 8 views
20

우분투 9.04 리포지토리에서 부스트 파이썬을 설치했습니다. 나는 튜토리얼에서 Build a Simple Program Using Boost을 성공적으로 실행했기 때문에, 그 부스트 파이썬이 내 시스템에 설치되어 있다는 것을 알고있다. 내가 공유 라이브러리 생성하는 두 단계 아래의 첫 번째 단계를 실행하려고 부스트 파이썬에서 "No such file or directory"오류가 발생했습니다.

#include <string> 

namespace { // Avoid cluttering the global namespace. 

    // A couple of simple C++ functions that we want to expose to Python. 
    std::string greet() { return "hello, world"; } 
    int square(int number) { return number * number; } 
} 
#include <boost/python.hpp> 
using namespace boost::python; 

BOOST_PYTHON_MODULE(getting_started1) 
{ 
    // Add regular functions to the module. 
    def("greet", greet); 
    def("square", square); 
} 

:

g++ -c -fPIC hello.cpp -o hello.o 
g++ -shared -Wl,-soname,libhello.so -o libhello.so hello.o 

은 (이러한 권리인가

그러나,이 프로그램은 아래의 오류를 반환 명령?)

다음은 완전한 오류 출력입니다.

In file included from /usr/include/boost/python/detail/prefix.hpp:13, 
      from /usr/include/boost/python/args.hpp:8, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/detail/wrap_python.hpp:50:23: error: pyconfig.h: No such file or directory 
/usr/include/boost/python/detail/wrap_python.hpp:75:24: error: patchlevel.h: No such file or directory 
/usr/include/boost/python/detail/wrap_python.hpp:78:2: error: #error Python 2.2 or higher is required for this version of Boost.Python. 
/usr/include/boost/python/detail/wrap_python.hpp:142:21: error: Python.h: No such file or directory 
In file included from /usr/include/boost/python/cast.hpp:13, 
      from /usr/include/boost/python/handle.hpp:10, 
      from /usr/include/boost/python/args_fwd.hpp:10, 
      from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/base_type_traits.hpp:24: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/base_type_traits.hpp:24: error: template argument 1 is invalid 
/usr/include/boost/python/base_type_traits.hpp:30: error: ‘PyTypeObject’ was not declared in this scope 
/usr/include/boost/python/base_type_traits.hpp:30: error: template argument 1 is invalid 
/usr/include/boost/python/base_type_traits.hpp:36: error: ‘PyMethodObject’ was not declared in this scope 
/usr/include/boost/python/base_type_traits.hpp:36: error: template argument 1 is invalid 
In file included from /usr/include/boost/python/handle.hpp:11, 
      from /usr/include/boost/python/args_fwd.hpp:10, 
      from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/errors.hpp:51: error: expected constructor, destructor, or type conversion before ‘*’ token 
In file included from /usr/include/boost/python/handle.hpp:13, 
      from /usr/include/boost/python/args_fwd.hpp:10, 
      from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/handle_fwd.hpp:12: error: expected type-specifier before ‘PyObject’ 
/usr/include/boost/python/handle_fwd.hpp:12: error: expected ‘>’ before ‘PyObject’ 
In file included from /usr/include/boost/python/handle.hpp:14, 
      from /usr/include/boost/python/args_fwd.hpp:10, 
      from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/refcount.hpp: In function ‘T* boost::python::incref(T*)’: 
/usr/include/boost/python/refcount.hpp:16: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/refcount.hpp: In function ‘T* boost::python::xincref(T*)’: 
/usr/include/boost/python/refcount.hpp:23: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/refcount.hpp: In function ‘void boost::python::decref(T*)’: 
/usr/include/boost/python/refcount.hpp:30: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/refcount.hpp: In function ‘void boost::python::xdecref(T*)’: 
/usr/include/boost/python/refcount.hpp:36: error: ‘PyObject’ was not declared in this scope 
In file included from /usr/include/boost/python/args_fwd.hpp:10, 
      from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/handle.hpp: In constructor ‘boost::python::handle<T>::handle(boost::python::detail::borrowed_reference_t*)’: 
/usr/include/boost/python/handle.hpp:130: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/handle.hpp:130: error: expected primary-expression before ‘)’ token 
/usr/include/boost/python/handle.hpp: At global scope: 
/usr/include/boost/python/handle.hpp:157: error: ‘PyTypeObject’ was not declared in this scope 
/usr/include/boost/python/handle.hpp:157: error: template argument 1 is invalid 
/usr/include/boost/python/handle.hpp:157: error: invalid type in declaration before ‘;’ token 
/usr/include/boost/python/handle.hpp:256: error: expected initializer before ‘*’ token 
In file included from /usr/include/boost/python/args.hpp:10, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/args_fwd.hpp:26: error: template argument 1 is invalid 
In file included from /usr/include/boost/python/object/pointer_holder.hpp:14, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/instance_holder.hpp:34: error: ‘PyObject’ has not been declared 
/usr/include/boost/python/instance_holder.hpp:41: error: expected ‘;’ before ‘(’ token 
/usr/include/boost/python/instance_holder.hpp:45: error: ‘PyObject’ has not been declared 
In file included from /usr/include/boost/python/object/pointer_holder.hpp:21, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/detail/wrapper_base.hpp:21: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:23: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:30: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:34: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:43: error: ‘PyObject’ has not been declared 
/usr/include/boost/python/detail/wrapper_base.hpp:44: error: ‘PyObject’ is neither function nor member function; cannot be declared friend 
/usr/include/boost/python/detail/wrapper_base.hpp:44: error: expected ‘;’ before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:49: error: ‘PyTypeObject’ has not been declared 
/usr/include/boost/python/detail/wrapper_base.hpp:55: error: expected ‘;’ before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp: In constructor ‘boost::python::detail::wrapper_base::wrapper_base()’: 
/usr/include/boost/python/detail/wrapper_base.hpp:46: error: class ‘boost::python::detail::wrapper_base’ does not have any field named ‘m_self’ 
/usr/include/boost/python/detail/wrapper_base.hpp: At global scope: 
/usr/include/boost/python/detail/wrapper_base.hpp:61: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:71: error: expected initializer before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:77: error: variable or field ‘initialize_wrapper’ declared void 
/usr/include/boost/python/detail/wrapper_base.hpp:77: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/detail/wrapper_base.hpp:77: error: ‘self’ was not declared in this scope 
/usr/include/boost/python/detail/wrapper_base.hpp:77: error: expected primary-expression before ‘*’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:77: error: ‘w’ was not declared in this scope 
/usr/include/boost/python/detail/wrapper_base.hpp:82: error: variable or field ‘initialize_wrapper’ declared void 
/usr/include/boost/python/detail/wrapper_base.hpp:82: error: ‘PyObject’ was not declared in this scope 
/usr/include/boost/python/detail/wrapper_base.hpp:82: error: expected primary-expression before ‘,’ token 
/usr/include/boost/python/detail/wrapper_base.hpp:82: error: expected primary-expression before ‘...’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:47, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:57, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:62, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:67, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:72, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:77, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:82, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:87, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:92, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:97, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:102, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:107, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:112, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:117, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:122, 
      from /usr/include/boost/python/object/pointer_holder.hpp:63, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:176: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:47, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:57, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:62, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:67, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:72, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:77, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:82, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:87, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:92, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
      from /usr/include/boost/python.hpp:11, 
      from first.cpp:9: 
/usr/include/boost/python/object/pointer_holder.hpp:199: error: expected `)' before ‘*’ token 
In file included from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:97, 
      from /usr/include/boost/python/object/pointer_holder.hpp:99, 
      from /usr/include/boost/python/to_python_indirect.hpp:10, 
      from /usr/include/boost/python/converter/arg_to_python.hpp:10, 
      from /usr/include/boost/python/call.hpp:15, 
      from /usr/include/boost/python/object_core.hpp:12, 
      from /usr/include/boost/python/args.hpp:25, 
+0

자습서 링크가 깨졌습니다. – robince

답변

9

파이썬 헤더 (Python.h 등)가 누락 된 것 같습니다. 운영 체제 패키지 관리자를 통해 Python 버전의 -devel 또는 -dev 패키지를 설치해야합니다. [편집 : 당신이 그렇게 sudo aptitude install python-dev 시도 우분투에있는주의]이

... 헤더 파일을 제공해야

+0

sudo aptitude install python-dev' helped me! 감사합니다. 감사! – Temak

30

#include <Python.h>를 추가하고 -I/usr/include/python2.6 또는 어떤 파이썬 버전이 컴파일.

-lpython2.6 -lboost_python

+4

같은 문제가 있었는데이 문제가 해결되었습니다. 만약 누군가가 데비안을 사용한다면 - 스퀴즈는 python-dev와 python2.6-dev 패키지를 가지고 있습니다. (수정을 위해 또 다른 5 분을 들여야합니다;) – tr9sh

+0

제 경우에는 동일한 문제가있었습니다. pyconfig.h를 찾아서 g ++ -shared -c -o greet.so -fPIC greet.cpp -lpython2.7 -lboostpython -I/usr/local/include/python2.7을 찾았습니다. –

3

빠르게 매우 복잡 얻을 수 등의 개별 명령을 실행하여 큰 프로그램을 만들기로 연결하는 것을 잊지 마십시오. CMake과 같은 빌드 시스템을 사용하여 종속성을 찾고 컴파일러 명령을 정렬 할 수 있습니다. 꽤 늦었어요,하지만 여전히, 여기에 내 대답은 비록

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} 
) 
10

:

당신이 libboost-python-이 있는지 확인 부스트 파이썬 프로젝트 CMake를 사용하는

최소 CMakeLists.txt이있다 dev 라이브러리 설치 :

sudo apt-get install libboost-python-dev 

이것은 나를위한 트릭입니다.

관련 문제