(Boost.Python) How to load header files?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Qun Cao

    #1

    (Boost.Python) How to load header files?

    Hi Everyone,

    I just started to use boost.python and having problem trying to get my
    first program working.

    I have a C++ class foo.cpp, defined in foo.h, I wrote a wrapper class
    for it to generate a python module.

    #include "Foo.h"

    #include <boost/python/module.hpp>
    #include <boost/python/def.hpp>
    #include <boost/python.hpp>
    using namespace boost::python;

    BOOST_PYTHON_MO DULE(mymodule)
    {
    class_<Foo>("Fo o")
    .def ("init", &Foo:init)

    }

    The problem is that when I bjam it, the compiler cannot find the header
    file <Foo.h>, although I had the location of Foo.h added into $PATH. I
    can make it work by copying Foo.h into the working directory, but Foo.h
    is also depended on other libraries, so I need a generic way to
    recognize the header files.

    Thanks for any hit,
    Qun

  • Neil Hodgson

    #2
    Re: (Boost.Python) How to load header files?

    Qun Cao wrote:
    I have a C++ class foo.cpp, defined in foo.h, I wrote a wrapper class
    for it to generate a python module.
    >
    #include "Foo.h"
    If you are on Windows it shouldn't matter but try to keep
    capitalisation consistent: #include "foo.h".
    The problem is that when I bjam it, the compiler cannot find the header
    file <Foo.h>, although I had the location of Foo.h added into $PATH.
    Headers don't go into $PATH. The bjam way is to use an include
    dependency in the Jamfile. One of my Jamfile's looks something like this
    with extra stuff removed:

    extension SinkWorld
    : # sources
    SinkWorld.cpp
    :
    <include>../../base
    <include>../../lexers
    ;

    I'm not a Jam or Boost expert and the best place for Boost.Python
    questions is


    Neil

    Comment

    Working...