Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Support for wchar_t and wstring

The standard C and C++ wide character type wchar_t and the wstring template class that makes use of it are supported in the system libraries for Mac OS X version 10.3 and later. As a result, you can freely use these data types in software created with Xcode that will run only in Panther and later. However, if you need to use these data types in software that will run in versions of Mac OS X prior to Panther, you should obtain a third-party standard C library, such as the one available from Dinkumware, Ltd..

Important: Although wchar_t and wstring are standards, they are somewhat vaguely defined and ambiguous ones. Mac OS X provides far better support for Wide and Unicode characters through the CFString APIs. Apple strongly recommends using these APIs on Mac OS X, as almost all other Mac OS X frameworks expect wide character strings to be in this format, and none support wchar_t and wstring.

CodeWarrior supports wchar_t and wstring for CFM applications because they are supported in the MSL C and C++ libraries for CFM. However, because MSL libraries for Mach-O in CodeWarrior do not anticipate wchar_t support in the Apple standard C libraries, wchar_t support is turned off in the MSL Mach-O standard library projects. This means that if you use CodeWarrior in Mac OS X v.10.3 or later, you'll get build errors when you rebuild the CodeWarrior MSL libraries because wchar_t support is turned off but the Mac OS X headers now use wchar_t.

To resolve this issue, when rebuilding your MSL libraries on Panther, you should select the “Enable wchar_t Support” checkbox in the C/C++ Language settings for the Mach-O library projects.



< Previous PageNext Page > Hide TOC


Last updated: 2006-10-26




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice