[pygccxml-development] help with constructor default argument error
Brought to you by:
mbaas,
roman_yakovenko
From: Kevin W. <kev...@gm...> - 2008-02-26 00:12:36
|
I'm new to Py++ but I've been experimenting with wrapping wxWidgets, the cross platform GUI library. It has gone fairly well, but I'm getting the following error and I'm not sure how to resolve it. In a header file somewhere, a global called "wxPanelNameStr" is declared: extern WXDLLEXPORT_DATA(const char) wxPanelNameStr[]; The implementation is in a CPP file somewhere else: extern WXDLLEXPORT_DATA(const char) wxPanelNameStr[] = "panel"; My problem arises in a constructor which uses wxPanelNameStr as the default value for one of its arguments: inline wxWindow(wxWindow *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr) Py++ generates the following code for this: .def( bp::init< wxWindow *, wxWindowID, bp::optional< wxPoint const &, wxSize const &, long int, wxString const & > >(( bp::arg("parent"), bp::arg("winid"), bp::arg("pos")=wxDefaultPosition, bp::arg("size")=wxDefaultSize, bp::arg("style")=(long int)(0), bp::arg("name")=wxPanelNameStr )) ); You'll note that the sixth argument takes a value of type const wxString&, but the default argument in the generated code is const char []. The error I get is long and does lots of complaining about convertables and char[], but ultimately I think it boils down to this line: ../boost_1_34_1/boost/python/type_id.hpp:88: error: invalid use of array with unspecified bounds wxString does have a constructor which takes const char*, so the implicit conversion should happen, but I think Boost::Python is getting confused. Does anyone know how I can resolve this? |