[C++-sig] [Py++] incomplete type and forward declaration

Werner Joergensen wjoergensen at yahoo.com
Fri May 29 12:20:56 CEST 2009


How can I process such a file classA.hpp using a code generator like http://www.language-binding.net/pyplusplus/documentation/tutorials/module_builder/generate_code.py.html?

----------8<---- classA.hpp ------
class B;

class A{
public:
  B& dontCareAboutB(){ /*return C::getB();*/ };
  void doSomething(){};
};
----------8<----------

This class compiles fine with just "g++ -c classA.hpp", but applying the pyplusplus code generator followed by bjam throws several errors:
...
/opt/boost_1_39_0/boost/python/type_id.hpp:89: error: invalid use of incomplete type ‘struct B’
./classA.hpp:1: error: forward declaration of ‘struct B’
...

If I replace the first line with "class B{}", making B a comple, empty class, this example succeeds. But then I run into more troubles if I add the actual definition of the real class B from another header file to the python module.

Does a solution with pyplusplus exist, where I don't need to modify the classA.hpp header file?

Thanks
Werner



      


More information about the Cplusplus-sig mailing list