Internationalization Cookbook
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Visual Studio Unicode projects

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).

Visual Studio 6 - compile options

Then set the entry to wWinMainCRTStartup.

Visual Studio 6 - linker options

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).

Visual Studio 2005 - project creation wizard

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:

Visual Studio 2005 - General - Character Set

It just makes life easy, because in the belly of the beast the same old trick is happening.

The defines are done:

Visual Studio 2005 - compiler options

and the entry point is set:

Visual Studio 2005 - linker options

Done! But this was the easy part.

How to get everything to compile properly after these changes, now that, is real work :-)

One comment to “Visual Studio Unicode projects”

  1. Rob Wells says:

    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.

Leave a comment