Can't compile basic boost.python program

I'm following the Boost.python tutorial, and having some problems with compiling, of all things. Here's the file I'm trying to compile: #include <boost-1_32/boost/python.hpp> char const* greet() { return "Hello, world!"; } using namespace boost::python; BOOST_PYTHON_MODULE(hello) { def("greet", greet); } And here's the compilation error: % make g++ -g -Wall -pedantic -I/usr/local/include/boost-1_32 -c -o test.o test.cpp In file included from /usr/local/include/boost-1_32/boost/python/detail/prefix.hpp:13, from /usr/local/include/boost-1_32/boost/python/args.hpp:8, from /usr/local/include/boost-1_32/boost/python.hpp:11, from test.cpp:1: /usr/local/include/boost-1_32/boost/python/detail/wrap_python.hpp:30:23: pyconfig.h: No such file or directory /usr/local/include/boost-1_32/boost/python/detail/wrap_python.hpp:54:24: patchlevel.h: No such file or directory /usr/local/include/boost-1_32/boost/python/detail/wrap_python.hpp:57:2: #error Python 2.2 or higher is required for this version of Boost.Python. /usr/local/include/boost-1_32/boost/python/detail/wrap_python.hpp:121:21: Python.h: No such file or directory In file included from /usr/local/include/boost-1_32/boost/python/cast.hpp:13, from /usr/local/include/boost-1_32/boost/python/handle.hpp:10, from /usr/local/include/boost-1_32/boost/python/args_fwd.hpp:10, from /usr/local/include/boost-1_32/boost/python/args.hpp:10, from /usr/local/include/boost-1_32/boost/python.hpp:11, from test.cpp:1: /usr/local/include/boost-1_32/boost/python/base_type_traits.hpp:24: error: ` PyObject' was not declared in this scope /usr/local/include/boost-1_32/boost/python/base_type_traits.hpp:25: error: template argument 1 is invalid /usr/local/include/boost-1_32/boost/python/base_type_traits.hpp:26: confused by earlier errors, bailing out make: *** [test.o] Error 1 As near as I can figure, my install of Boost got screwed up. Does anyone else have a different interpretation? -Chris Weisiger

Derakon wrote:
I'm following the Boost.python tutorial, and having some problems with compiling, of all things. Here's the file I'm trying to compile:
#include <boost-1_32/boost/python.hpp>
As near as I can figure, my install of Boost got screwed up. Does anyone else have a different interpretation?
Your addition of the Boost include path is wrong. If it where correct the above would be: #include <boost/python.hpp> You need to add the ../include/boost-1_32 directory, not the ../include directory. HTH. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

Rene Rivera wrote:
Derakon wrote:
I'm following the Boost.python tutorial, and having some problems with compiling, of all things. Here's the file I'm trying to compile:
#include <boost-1_32/boost/python.hpp>
As near as I can figure, my install of Boost got screwed up. Does anyone else have a different interpretation?
Your addition of the Boost include path is wrong. If it where correct the above would be:
#include <boost/python.hpp>
You need to add the ../include/boost-1_32 directory, not the ../include directory.
Oops.. replied a bit too fast there :-) Read you message again and noticed you did include the correct path. So two things I can see wrong.. 1. The above #include problem I mentioned. 2. You need to tell GCC where to find the Python headers. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
participants (2)
-
Derakon
-
Rene Rivera