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 » Fri Dec 23, 2011 11:27 pm
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: 15512
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Post
by doublemax » Fri Dec 23, 2011 11:43 pm
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 » Fri Dec 23, 2011 11:50 pm
How stupid I am

Maybe I should sleep.
Thank you,but its used in the book.(cross-platform gui programming with wxwidgets)