473,382 Members | 1,107 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,382 software developers and data experts.

(Boost.Python) How to load header files?

Hi Everyone,

I just started to use boost.python and having problem trying to get my
first program working.

I have a C++ class foo.cpp, defined in foo.h, I wrote a wrapper class
for it to generate a python module.

#include "Foo.h"

#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python.hpp>
using namespace boost::python;

BOOST_PYTHON_MODULE(mymodule)
{
class_<Foo>("Foo")
.def ("init", &Foo:init)

}

The problem is that when I bjam it, the compiler cannot find the header
file <Foo.h>, although I had the location of Foo.h added into $PATH. I
can make it work by copying Foo.h into the working directory, but Foo.h
is also depended on other libraries, so I need a generic way to
recognize the header files.

Thanks for any hit,
Qun

Aug 8 '06 #1
1 2592
Qun Cao wrote:
I have a C++ class foo.cpp, defined in foo.h, I wrote a wrapper class
for it to generate a python module.

#include "Foo.h"
If you are on Windows it shouldn't matter but try to keep
capitalisation consistent: #include "foo.h".
The problem is that when I bjam it, the compiler cannot find the header
file <Foo.h>, although I had the location of Foo.h added into $PATH.
Headers don't go into $PATH. The bjam way is to use an include
dependency in the Jamfile. One of my Jamfile's looks something like this
with extra stuff removed:

extension SinkWorld
: # sources
SinkWorld.cpp
:
<include>../../base
<include>../../lexers
;

I'm not a Jam or Boost expert and the best place for Boost.Python
questions is
http://mail.python.org/mailman/listinfo/c++-sig

Neil
Aug 8 '06 #2

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

Similar topics

1
by: Bren | last post by:
Hi, Pardon my stupid, but I'm having a problem building Boost.Python as per the instructions at http://www.boost.org/libs/python/doc/building.html I got boost-build-2.0-m6.zip from...
0
by: Gouda Man | last post by:
I'm planning to write a large program that will have advanced scripting in python in which the scripter will subclass c++ objects to add functionality. this leads me to boost.python (if you dont...
3
by: Joe bloggs | last post by:
Can anyone tell me how to get boost.python to work on Debian Sarge? When I try to build the tutorial hello world example bjam reports: ...
1
by: Max Wilson | last post by:
Hi, Has anyone here built Boost.Python modules under MinGW? I'm trying to build the Boost.Python tutorial under MinGW and getting an error that says it depends on MSVC, which puzzles me because...
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:...
6
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...
2
by: mr_gees100_peas | last post by:
Hi, I've been trying for days to make either boost.python or swig to work for me. The one I have gotten the closest to is boost. Note that this is for windows XP. I'm not much of an unix person...
5
by: usenet | last post by:
Is there any way to selectively suppress compiler warnings from designated header files (Ex: Boost header files) using gcc-3.3.1 on Linux PC? We tried using -Wno-system-headers option but it did...
0
by: Stodge | last post by:
I'm having issues with Boost Python, downloaded via http://www.boostpro.com. I *think* it's related to WinXP side by side assemblies. My application that uses Boost Python fails to start. I ran...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.