473,466 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1767
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.