/Zc:wchar_t
If /Zc:wchar_t is not specified, the compiler requires you to either define wchar_t or to include one of the many header files that defines it (for example, wchar.h). Typically, wchar_t is defined as an unsigned short.
When the /Zc:wchar_t compiler option is specified, the type wchar_t becomes a native type that maps to __wchar_t in the same way that short maps to __int16.
With /Zc:wchar_t, the compiler recognizes wchar_t as a native type. See Data Type Ranges for more information about wchar_t.
__wchar_t is always available.
By providing overloads for both the unsigned short and __wchar_t variations of wchar_t, you can create libraries that can easily be linked with code compiled with or without /Zc:wchar_t and avoid the need to provide two different builds of the library (one with and one without /Zc:wchar_t enabled).
When /Zc:wchar_t is specified, _WCHAR_T_DEFINED and _NATIVE_WCHAR_T_DEFINED symbols are defined; see Predefined Macros for more information.
For more information about conformance issues with Visual C++, see Standard Compliance Issues in Visual C++.
To set this compiler option in the Visual Studio development environment
- Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
- Click the C/C++ folder.
- Click the Language property page.
- Modify the Treat wchar_t as Built-in Type property.
To set this compiler option programmatically
See TreatWChar_tAsBuiltInType Property.