473,544 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get BOOST working on XP and Visual C++ 2005

My experiences with BOOST on Windows XP and Visual C++ 2005

I'm new to Python.
I built software in more than ten other computer languages. I'm not
sure if that is not a handicap, when reading documentation of a system
like BOOST.
However:
It took me more than four full working days to get a Python/C/C++
'hello world!' program to work. There is a lot of documentation, but
somehow it did not 'click' with my previous experience. I think the
doc was written by very, very capable C++ and Python programmers, who
forgot how the world was before they got involved with Python.
A teacher/doc writer should never forget that, I think.
Mind you: the documentation is all there. Stressing the word ALL.
There is a lot of documentation. Which makes it very difficult to
choose the right piece.

My project is, to use old and tested and stable and error-free C-code
in a website built with Zope (www.zope.org) and Plone (www.plone.org).
So I think, C-code can be wrapped in some C++ and then, with the help
of Boost, be called from Python. Python is important when using Plone.

So let me summarize what I found out.

BOOST is a system to combine Python and C++. Call C++ compiled code
from Python, which is interpreted.
In the end, BOOST is a sort of "make" facility like found on Linux
(and Windows). In Boost it is called, not 'make.exe', but 'bjam.exe'.
You define a list of operations, which bjam executes for you. It runs
from the command line (I grew up, IT-wise, in the DOS-era. Hurray), it
has no GUI-like Windows front-end.

So the first step is to get bjam.exe from the net. There are two ways
to get it:
1. download a ready-to-run bjam.exe from
http://downloads.sourceforge.net/boo...7&big_mirror=0.
In the zip you will find the bjam.exe, which you put it in a place
where the system can always find it, like in c:\, or somewhere else in
the system's PATH.
2. download the sources for bjam.exe and build it yourself:
http://downloads.sourceforge.net/boo...5&big_mirror=0
.. I recommend not to do this, if you don't have to. And on Windows XP,
you don't have to. You could spend a lot of time to figure out how to
set up things before even building bjam.exe.

The second step is to get Boost libraries. These are for combining
with your C/C++ source, so Python can access the C/C++ code.
You download this stuff from Sourceforge:
http://downloads.sourceforge.net/boo...1&big_mirror=0
It is a zip file that you unzip to a convenient location. I unzipped
to D:\ so I got a folder named d:\boost_1_31_1 with all the stuff in
it. I renamed this folder to d:\boost, to get rid of all the messy
version numbers.
To build the boost libraries from these sources, you need bjam, and
bjam makes use of your C/C++ compiler. In my case that was Microsoft
Visual C++ 2005, which has version number 8.0.
Now you have to make bjam and Visual C++ acquainted with the location
of supporting software. I made a BAT file to do this. This is what is
in that .BAT file, named SET.BAT and which I put in D:\boost:

d:
cd \boost
call e:\msvc\vc\vcva rsall.bat
set VC80_ROOT=e:\ms vc\vc
set TOOLS=vc-8_0
set PYTHON_ROOT=c:\ python24
set PYTHON_VERSION= 2.4

I explain:
e:\msvc is where I installed my Visual C++ system. The Microsoft
default location would be something like C:\Microsoft Visual C 2005\
etc, but I preferred D:\msvc.
Change the SET.BAT file as needed .
My IDLE (http://www.python.org/idle/) Python 2.4 is in C:\python24
The value 'vc-8_0' denotes the boost identification of my MS Visual
C++ system. If you use an other C++ system, it must be something else
(see http://www.boost.org/more/getting_started.html)

Now start a DOS box: Click the Start button in the lower left corner,
click on "run" and type "cmd".
There you switch to D:\ and change directory to \BOOST.
Execute the SET.BAT.
Then just type "bjam" (the system will find the program bjam itself,
because it is in the PATH)

Now get a lot of coffee, because the build will take a LONG time,
maybe 15 minutes or more.
You will see a lot of cpp-compiling and linking going on and some
warnings about 'deprecation', which are irrelevant.

When finished, keep the DOS box open. You will find BOOST stuff in
C:\boost, the default location for the compiling results.

Now try out an example. In the DOS box, go to
D:\boost\libs\p ython\example\t utorial, where you find a 'hello'
example and a Jamfile. Jamfile's are what a makefile is for make.: a
script for bjam to build all the 'hello' stuff needed for python.

Type 'bjam' again, and take a smaller amount of coffee. The system
will build the 'hello' stuff for you. Do not be alarmed about bjam
finding 1200+ 'targets' and rebuilding 40 of them, when only needing
to compile hello.cpp…. this is normal behaviour.

When bjam has finished, you will find 'hello' stuff in the
unbelievably deep folder
D:\boost\libs\p ython\example\t utorial\bin\tut orial\hello.pyd \vc-8_0\debug\threa ding-multi
Really. I don't know why this must be so deep.
And some Boost stuff in the even more deep folder
D:\boost\libs\p ython\example\t utorial\bin\boo st\libs\python\ build\boost_pyt hon.dll\vc-8_0\debug\threa ding-multi

Find the hello.pyd and boost_python.dl l and move them to the folder
where yout python.exe is, in my case c:\python24.

Now you go to
file:///D:/boost/libs/python/doc/tutorial/doc/html/python/hello.html
which is part of the Boost download. and read the page.
That should get you on your way.
Of course, now it might be beneficial to you to start reading the
other documentation on
http://www.boost.org/more/getting_started.html
Jan 2 '07 #1
0 1758

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

Similar topics

8
2062
by: googlebart2000 | last post by:
I'm about to be a new user of the Boost C++ library, and I've installed and compiled it, but I've come up empty on how to use it in my C++ programs. I can't find the documentation that explains which library (name? location?) to use for the uBLAS portion. Can anyone point me to some simple examples somewhere? Advance thanks, -ted in AZ
6
1750
by: George M. Garner Jr. | last post by:
VC8.0 crashes while compiling boost-1.33.1 serialization library (or any other library that includes the serialization headers) if code analysis (/analyze) is enabled. This problem did not occur with prior beta releases of boost-1.33.1 or with the VC8.0 beta. You may want to consider whether the crash of a dependent tool should be allowed to...
0
2496
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some of you might have an answer. I would greatly appreciate help with this, as I tried to search for an answer for quite some time in vain. I am...
4
4945
by: CPettsson | last post by:
Hello all I've been trying for the last two days to install Boost to Visual C++ 2005 Express Edition. I followed the instructions on the site (http://www.boost.org/more/getting_started.html), other helps I found by google:ing and reading around in newsgroups. I think I'm doing it the right way, but it still won't work completely. All the...
4
2261
by: JDJMSon | last post by:
I was wondering if someone here could help me with a problem I'm having building Python extensions with the Boost.Python library. Basically, if I have a wrapper class with something like this: string TestFunc() { return "Hello World"; } BOOST_PYTHON_MODULE(TestClass)
11
4889
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: ============================ #include <iostream> #include <stdafx.h>
0
970
by: Osiris | last post by:
I read a lot of the html pages on installing boost etc. Still a lot of confusion. Here is what I want: I have old, stable wonderful C-code I want to use in Python projects. So I encapsulate the C-code in some C++ stuf and try to compile it into a DLL. 1: I DL-ed boost_1_33_1.exe (I use WinXP) and unpacked to D:\boost 2: I started my MS...
6
7661
by: Soren | last post by:
Hi! I'm trying to extend my python program with some C++ code. Right now I've spent hours just trying to get boost to work! I'm trying to get the example hello.cpp to work. Using Windows XP and Visual Studio 8 (.NET 2005) I've set BOOST_BUILD_PATH = C:\boost\boost_1_33_1 (where i installed
3
2017
by: Unknownmat | last post by:
Here is the smallest code I could come up with to reproduce the I was able to reproduce the warning with an even smaller snippet of code: #include <vector> #include <functional> #include <boost/function.hpp> int main()
0
7796
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7405
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7737
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5950
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4938
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
688
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.