about ArrayString Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
newbee
In need of some credit
In need of some credit
Posts: 8
Joined: Sat Nov 19, 2011 8:54 pm

about ArrayString

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

User avatar
doublemax
Moderator
Moderator
Posts: 14990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: about ArrayString

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
In need of some credit
Posts: 8
Joined: Sat Nov 19, 2011 8:54 pm

Re: about ArrayString

Post by newbee » Fri Dec 23, 2011 11:50 pm

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

Post Reply