Page 1 of 1

Migrating non-unicode app to 2.9.1

Posted: Tue Jan 04, 2011 4:33 pm
by pkullmann
My app is non-unicode until now (MSVC).
I am trying to migrate to wxWidgets 2.9.1 and find some problems with it, but no enlightment in the docs.

I don't know how it's meant to be, but it seems that I have to define _UNICODE for my projects when using 2.9.1
If I don't, there might be inconsistencies, since 2.9.1 does define _UNICODE by itself (platform.h set _UNICODE if wxUSE_UNICODE is defined). However, a project might not necessarily include wxwidgets in each and every source file, so this can lead to a mixture and doesn't seem to be safe.

Will defining _UNICODE be sufficient, or are there other things to be considered? Anyone have specific experience?

Posted: Thu Jan 06, 2011 7:57 pm
by smartrabbit
I had a similar problem when porting my application to 2.9.1 because I needed some new functionality of this version.

The fastest way to use improvements of this version was to force the ANSI release by define wxUSE_UNICODE=0 in the compiler options.

Maybe it's not the best solution for future releases (I still have to adapt my code to unicode) but for now it's the easiest way.

Posted: Mon Jan 24, 2011 11:20 am
by pkullmann

I chose the other option to migrate to unicode now. This however entailed that I had to migrate a whole bunch of other libs to unicode as well.

It took a couple of days to resolve all issues, but now it's done and it works. :-)

But I still wonder about the claim, that the ansi and unicode build have been merged into one. As I see it, one still needs wxUSE_UNICODE 0 for ANSI based apps and 1 for unicode apps, makes again two different builds!

Posted: Mon Jan 24, 2011 3:45 pm
by Auria
What is meant is that now ASCII strings are implicitly converted to wxString; so before you needed to add wxT() around all strings literals to make them wchar_t* strings. This implicit conversion now makes it possible to use a wxWidgets unicode-enabled build but in the same way that non-unicode 2.8 builds were used, without wxT