Home:ALL Converter>wxWidgets: wxString::wxString(int) private within this context

wxWidgets: wxString::wxString(int) private within this context

Ask Time:2010-06-29T04:55:06         Author:jstm88

Json Formatter

I have a subclass of wxHtmlListBox called TestClass, but I get the error:

/usr/include/wx-2.8/wx/string.h:682:0 /usr/include/wx-2.8/wx/string.h:682: error: 'wxString::wxString(int)' is private
MainFrame.cpp:106:0 MainFrame.cpp:106: error: within this context

MainFrame.cpp line 106 is this:

TestClass *tc = new TestClass(this, wxID_ANY, wxDefaultPosition, 
                              wxDefaultSize, NULL, wxBORDER_DEFAULT);

The files for TestClass can be found at http://cl.ly/1VSo

Any thoughts on this?

Author:jstm88,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/3136055/wxwidgets-wxstringwxstringint-private-within-this-context
Jon Cage :

You're passing wxBORDER_DEFAULT into a const wxString reference:\n\nTestClass(\n wxWindow* parent, // this\n wxWindowID id = wxID_ANY, // wxID_ANY\n const wxPoint& pos = wxDefaultPosition, // wxDefaultPosition\n const wxSize& size = wxDefaultSize, // wxDefaultSize\n long style = 0, // NULL\n const wxString& name = wxHtmlListBoxNameStr ); // wxBORDER_DEFAULT\n\n\n...but wxBORDER_DEFAULT is part of an enum (essentially an integer):\n\nenum wxBorder\n{\n /* this is different from wxBORDER_NONE as by default the controls do have */\n /* border */\n wxBORDER_DEFAULT = 0,\n\n wxBORDER_NONE = 0x00200000,\n wxBORDER_STATIC = 0x01000000,\n wxBORDER_SIMPLE = 0x02000000,\n wxBORDER_RAISED = 0x04000000,\n wxBORDER_SUNKEN = 0x08000000,\n wxBORDER_DOUBLE = 0x10000000, /* deprecated */\n wxBORDER_THEME = 0x10000000,\n\n /* a mask to extract border style from the combination of flags */\n wxBORDER_MASK = 0x1f200000\n};\n\n\nSo it's using the constructor you mentioned for a wxString:\n\nwxString::wxString(int)\n\n\n...which is private and hence you're getting an error. Try passing in a string or NULL instead :-)",
2010-06-28T21:13:41
yy