Q. How do I compile my Visual Studio project as Unicode?
A. Simple! Just follow the white rabbit this guide :-)
Short-short story: define UNICODE
, _UNICODE
and change the entry point to wWinMainCRTStartup
.
And yes, you need both defines, because UNICODE
affects Windows API (things like MessageBox
and CreateFile
) and _UNICODE
affects the C Runtime (things like _tprintf
and _topen
).
In Visual Studio 6 you really have to do the above changes “by hand,” but in the newer versions you just select the option in a menu.
Why put this together? Because the question gets asked, and is so much easier to point someone to a web page, instead of typing the whole story again and again :-)
Visual Studio 6
Define _UNICODE
and UNICODE
(if _MBCS
was defined, deleted it).
Then set the entry to wWinMainCRTStartup
.
Visual Studio 2005 (and 2003)
Here you have the option when you create the application using the wizard (and in Visual Studio 2005 “Use Unicode libraries” it checked by default).
But if you missed it, or the project is older, it is still easy to change it.
Just go to project properties and change the “Character Set” option:
It just makes life easy, because in the belly of the beast the same old trick is happening.
The defines are done:
and the entry point is set:
Done! But this was the easy part.
How to get everything to compile properly after these changes, now that, is real work :-)
Thanks. After searching for a couple of hours on where to find the checkbox in Visual Studio 6.0, I ran across this solution and it worked perfectly! Good old-fashioned brute force.