Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
We recommend using Visual Studio 2017

/ZW (Windows Runtime Compilation)


The latest version of this topic can be found at -ZW (Windows Runtime Compilation).

Compiles source code to support Visual C++ component extensions (C++/CX) for the creation of Windows 8.x Store apps.

When you use /ZW to compile, always specify /EHsc as well.

/ZW /EHsc  
/ZW:nostdlib /EHsc  

Indicates that Platform.winmd, Windows.Foundation.winmd, and other default Windows metadata (.winmd) files are not automatically included in the compilation. Instead, you must use the /FU (Name Forced #using File) compiler option to explicitly specify Windows metadata files.

When you specify the /ZW option, the compiler supports these features:

  • The required metadata files, namespaces, data types, and functions that your app requires to execute in the Windows Runtime.

  • Automatic reference-counting of Windows Runtime objects, and automatic discarding of an object when its reference count goes to zero.

Because the incremental linker does not support the Windows metadata included in .obj files by using the /ZW option, the /Gm (Enable Minimal Rebuild) option is incompatible with /ZW.

For more information, see Visual C++ Language Reference.

Compiler Options
Setting Compiler Options

© 2018 Microsoft