boost

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

    boost

    Hi everybody.

    I'm trying to use boost, but just don't know how to set it up.

    My os is winXP (installed on disk D).
    Python is installed in D:\Python25
    MigGW compiler is installed in D:\MinGW (i downloaded it because djgpp
    is making much more errors with bjam)

    I have downloaded boost_1_35_0.zi p and boost-jam-3.1.16-1-ntx86.zip,
    extracted boost_1_35_0.zi p to D:\Program Files (so I have now D:\Program
    Files\boost_1_3 5_0), extracted there bjam and used bjam in cmd:

    bjam --build-dir="D:\Program Files\boost_1_3 5_0" --toolset=gcc stage

    I got 12 failures and 8 warnings from this (other few hundrds were ok)


    I'm now trying to compile World.cpp and use it from python


    World.cpp:
    --------------------------
    #include "boost/python.hpp"
    using namespace boost::python;

    BOOST_PYTHON_MO DULE(hello)
    {
    class_<World>(" World")
    .def("greet", &World::gree t)
    .def("set", &World::set)
    ;
    }


    struct World
    {
    void set(std::string msg) { this->msg = msg; }
    std::string greet() { return msg; }
    std::string msg;
    };
    --------------------------



    When trying to compile it I get:
    ----------------------------
    E:\Source>g++ World.cpp
    World.cpp:1:28: boost/python.hpp: No such file or directory
    World.cpp:2: error: `boost' has not been declared
    World.cpp:2: error: `python' is not a namespace-name
    World.cpp:2: error: expected namespace-name before ';' token
    World.cpp:4: error: expected constructor, destructor, or type conversion
    before
    '(' token
    World.cpp:15: error: `std::string' has not been declared
    World.cpp:15: error: ISO C++ forbids declaration of `msg' with no type
    World.cpp:16: error: using-declaration for non-member at class scope
    World.cpp:16: error: expected `;' before "greet"
    World.cpp:17: error: expected `;' before "std"
    World.cpp:17: error: using-declaration for non-member at class scope
    World.cpp:17: error: expected `;' before "msg"
    World.cpp: In member function `void World::set(int) ':
    World.cpp:15: error: 'struct World' has no member named 'msg'
    ----------------------------


    What have i done wrong and what should have been done instead?

    Thank you in advance. :)
  • Ulrich Eckhardt

    #2
    Re: boost

    deepest1 wrote:
    bjam --build-dir="D:\Program Files\boost_1_3 5_0" --toolset=gcc stage
    >
    I got 12 failures and 8 warnings from this (other few hundrds were ok)
    Hmm, I remember trying to use Boost 1.35 with Python 2.5 on my Debian system
    and also having problems, are you sure that at least the Python helper libs
    are correctly compiled?
    E:\Source>g++ World.cpp
    World.cpp:1:28: boost/python.hpp: No such file or directory
    Try -I "D:\Program Files\boost_1_3 5_0" as additional argument. Further, you
    will need to tell g++ to link with the according boost library
    (-lboost_python or something like that) and where it can find that lib
    (-L"D:\Program Files\boost_1_3 5_0\stage").

    Uli

    --
    Sator Laser GmbH
    Geschäftsführ er: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

    Comment

    • deepest1

      #3
      Re: boost

      Thanks for help.

      I lost more then 10 hours on boost today, but it finally works, and I'm
      pleased with it.

      :)

      Comment

      Working...