473,289 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

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.zip and boost-jam-3.1.16-1-ntx86.zip,
extracted boost_1_35_0.zip to D:\Program Files (so I have now D:\Program
Files\boost_1_35_0), extracted there bjam and used bjam in cmd:

bjam --build-dir="D:\Program Files\boost_1_35_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_MODULE(hello)
{
class_<World>("World")
.def("greet", &World::greet)
.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. :)
Jun 27 '08 #1
2 1756
deepest1 wrote:
bjam --build-dir="D:\Program Files\boost_1_35_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_35_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_35_0\stage").

Uli

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

Jun 27 '08 #2
Thanks for help.

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

:)
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sbobrows | last post by:
{Whilst I think much of this is OT for this newsgroup, I think the issue of understanding diagnostics just about gets under the door. -mod} Hi, I'm a C++ newbie trying to use the Boost regex...
1
by: Hardy | last post by:
Hi, just come into the boost world. just the first.cpp in the program_options examples, with many link error... devc++4.9.9.2, gcc 3.4.2, can I get your opinions on this problem? thank you~ ...
1
by: 张沈鹏 | last post by:
How to compile the HelloWorld of boost.asio? Maybe this is a stupid problem , but I really don't konw how to find the right way. My compile environment is WinXP, Msys , MinGw , G++ 3.4.2,...
11
by: Osiris | last post by:
I have these pieces of C-code (NOT C++ !!) I want to call from Python. I found Boost. I have MS Visual Studio 2005 with C++. is this the idea: I write the following C source file:...
1
by: Yahooooooooo | last post by:
Just practicing BOOST regular expressions....giving errors... -- wanted to replace SPACE with NULL. #include <iostream> #include <fstream> #include <sstream> #include <string> #include...
1
by: =?UTF-8?B?SmVucyBNw7xsbGVy?= | last post by:
(I also posted this to boost-user) The BGL implementation of breadth-first search uses a dedicated color map. I had the following idea: Some algorithms don't need to distinguish black/gray,...
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
2
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
1
by: Tim H | last post by:
Compiling with g++ 4: This line: if_then_else_return(_1 == 0, 64, _1) When called with a bignum class as an argument yields: /usr/include/boost/lambda/if.hpp: In member function 'RET...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.