[C++-sig] confusion about how to use Boost

Erik erik.terwiel at planet.nl
Tue Jan 2 09:18:30 CET 2007


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 Visual C++ 2005 and told the Studio that my
python2.4 includes and libs are at c:\python24\include and c:\python24\libs
3: I found the project in D:\boost\libs\python\build\VisualStudio and Studio
converted that to the 8.0 version of my VC.
4: I compiled and got stuff in D:\boost\libs\python\build\bin-stage:
      208.896 boost_python.dll
       99.090 boost_python.exp
      166.216 boost_python.lib
      532.480 boost_python_debug.dll
       99.102 boost_python_debug.exp
      168.490 boost_python_debug.lib
    6.450.176 boost_python_debug.pdb
(the numbers are sizes)

Am I now set up to start on my own projects ?

Do I need bjam from here on ? or can I continue to do my own projects in VC
?

do I need all the stuff in the folders  like D:\boost\libs\* (except
D:\boost\libs\python) ? they do not seem to be used till now...


here is an example of mine, taken from the Visual C++ workspace.
However, I get the compile log (http://213.10.133.192/BuildLog.htm)

========================================
#include <stdlib.h>
#include <stdafx.h>

namespace { // Avoid cluttering the global namespace.

int my_int;   /* a global integer: or outside namespace ? */
double calc ( double f)
{
    my_int = (int) (f/2);
 //   printf( "Half of %f is %d\n", f, my_int ); 
    return f/2;
}
}

#include <boost/python.hpp>

using namespace boost::python;

BOOST_PYTHON_MODULE( half )
{
    def("calc", calc );
}




More information about the Cplusplus-sig mailing list