If you are using
wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
-
newbee
- In need of some credit
- Posts: 8
- Joined: Sat Nov 19, 2011 8:54 pm
Post
by newbee »
Hi,
Code: Select all
const wxArrayString choices;
choices.Add(wxT(“One”));
choices.Add(wxT(“Two”));
choices.Add(wxT(“Three”));
choices.Add(wxT(“Four”));
choices.Add(wxT(“Five”))
;
what is wrong with this?
my compiler says:
39 myapp.cpp passing `const wxArrayString' as `this' argument of `size_t wxArrayString::Add(const wxString&, size_t)' discards qualifiers
-
doublemax
- Moderator
- Posts: 19160
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Post
by doublemax »
If a variable is "const", you can't make changes to it - that includes adding strings
Use the source, Luke!
-
newbee
- In need of some credit
- Posts: 8
- Joined: Sat Nov 19, 2011 8:54 pm
Post
by newbee »
How stupid I am
Maybe I should sleep.
Thank you,but its used in the book.(cross-platform gui programming with wxwidgets)