Migrating non-unicode app to 2.9.1 Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
pkullmann
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Nov 30, 2006 6:15 pm

Migrating non-unicode app to 2.9.1

Post by pkullmann » Tue Jan 04, 2011 4:33 pm

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?

smartrabbit
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Aug 14, 2010 1:48 pm
Location: Switzerland

Post by smartrabbit » Thu Jan 06, 2011 7:57 pm

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.
There are 10 people on this world. Those who understand binary and those who don't.

pkullmann
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Nov 30, 2006 6:15 pm

Post by pkullmann » Mon Jan 24, 2011 11:20 am

Thanks.

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!

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Mon Jan 24, 2011 3:45 pm

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
"Keyboard not detected. Press F1 to continue"
-- Windows

Post Reply