[C++-sig] Base class defined in other header file not included in bp::bases<>

Haridev, Meghana mharidev at qualcomm.com
Thu Jul 13 01:18:50 CEST 2006

Hi Folks,


I'm having some trouble generating boost-python wrapper code using
pyplusplus for a derived class which has one of its base classes defined
in another file.


Simple scenario:




            class baseB{ };




#include "other.hpp"

class baseA{ };

class derivedC: public baseA, public baseB{ };



            import os

from pyplusplus import module_builder


mb = module_builder.module_builder_t( files=['hierarchy.hpp'] )

mb.build_code_creator( module_name='inherit' )

mb.code_creator.user_defined_directories.append( os.path.abspath('.') )




Generated code (boost_hierarchy.cpp) looks like this:


// This file has been generated by pyplusplus.

#include "boost/python.hpp"

#include "hierarchy.hpp"


namespace bp = boost::python;



    bp::class_< baseA >( "baseA" );


    bp::class_< derivedC, bp::bases< baseA > >( "derivedC" );



How can I get pyplusplus to add 'baseB' to bp::bases<> for 'derivedC'
class when 'baseB' class is defined in another file (present in the same
directory or different directory)?


When I move the definition of 'baseB' class to hierarchy.hpp, boost
wrapper for 'derivedC' is correctly generated as: bp::class_< derivedC,
bp::bases< baseA, baseB > >( "derivedC" );





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060712/c636c9f3/attachment.htm>

More information about the Cplusplus-sig mailing list