Setting Up Visual C++ Projects for Unicode
The libraries and DLLs for ANSI and Unicode development have different names but reside in the same directory. You do not need to change any search paths to use one mode or the other.
Most of the sample projects included in CVL are set to build only in ANSI mode. To use Unicode, you will need to modify the sample project files as well as your own project files as follows. The steps shown are for Visual C++ 6.0; the procedure is analogous for Visual C++ .NET.
- First, create a new configuration for Unicode:
- In Visual C++, select Build->Configurations.
- Click the Add button.
- Type a name for a new Unicode configuration and click OK.
- In the Configurations dialog box, click Close.
- Select Build->Set Active Configuration.
- Select the new Unicode configuration and click OK.
- Next, define the UNICODE and _UNICODE preprocessor symbols:
- Select Project->Settings.
- Click the C/C++ tab.
- Add the following symbols to the Preprocessor definitions text box:
UNICODE, _UNICODE
When these symbols are defined, Visual C++ uses the Unicode versions of the CVL DLLs. These DLLs have the letter “u” appended to their names, as discussed in ANSI and Unicode Libraries.
- Next, choose the entry point for Unicode:
- While still in the Project Settings dialog box, click the Link tab.
- From the Category drop-down list, select Output.
- In the Entry-point symbol field, type the appropriate entry point for Unicode:
- - For a GUI Unicode application, the entry point is wWinMainCRTStartup.
- - For a console application, the entry point is wmainCRTStartup.
- Click OK.
- Finally, set the debugger to display Unicode strings:
- Select Tools->Options.
- Click the Debug tab.
- Make sure the Display unicode strings check box is checked.
- Click OK.