Compiler and Linker options (C++/CX)
An environment variable, C++/CX compiler options, and linker options support the building of apps for the Windows Runtime.
Library path
The %LIBPATH% environment variable specifies the default path to search for .winmd files.
Compiler options
Option | Description |
---|---|
/ZW /ZW:nostdlib |
Enables Windows Runtime language extensions. The nostdlib parameter prevents the compiler from using the standard, predefined search path to find assembly and .winmd files.The /ZW compiler option implicitly specifies the following compiler options: - /FI vccorlib.h, which forces inclusion of the vccorlib.h header file that defines many types that are required by the compiler. - /FU Windows.winmd, which forces inclusion of the Windows.winmd metadata file that's provided by the operating system and defines many types in the Windows Runtime. - /FU Platform.winmd, which forces inclusion of the Platform.winmd metadata file that's provided by the compiler and defines most types in the Platform family of namespaces. |
/AI dir | Adds a directory, which is specified by the dir parameter, to the search path that the compiler uses to find assembly and .winmd files. |
/FU file | Forces the inclusion of the specified module, or .winmd file. That is, you don't have to specify #using file in your source code. The compiler automatically forces the inclusion of its own Windows metadata file, Platform.winmd. |
/D "WINAPI_FAMILY=2" | Creates a definition that enables the use of a subset of the Win32 SDK that's compatible with the Windows Runtime. |
Linker options
Option | Description |
---|---|
/APPCONTAINER[:NO] | Marks the executable as runnable in the appcontainer (only). |
/WINMD[:{NO|ONLY}] | Emits a .winmd file and an associated binary file. This option must be passed to the linker for a .winmd to be emitted. NO—Doesn't emit a .winmd file, but does emit a binary file. ONLY—Emits a .winmd file, but doesn't emit a binary file. |
/WINMDFILE:filename | The name of the .winmd file to emit, instead of the default .winmd file name. If multiple file names are specified on the command line, the last name is used. |
/WINMDDELAYSIGN[:NO] | Partially signs the .winmd file and places the public key in the binary. NO—(Default) Doesn't sign the .winmd file. /WINMDDELAYSIGN has no effect unless /WINMDKEYFILE or /WINMDKEYCONTAINER is also specified. |
/WINMDKEYCONTAINER:name | Specifies a key container to sign an assembly. The name parameter corresponds to the key container that's used to sign the metadata file. |
/WINMDKEYFILE:filename | Specifies a key or a key pair to sign the assembly. The filename parameter corresponds to the key that's used to sign the metadata file. |
Remarks
When you use /ZW, the compiler automatically links to the DLL version of the C Runtime (CRT). Linking to the static library version is not allowed, and any use of CRT functions that are not allowed in a Universal Windows Platform app will cause a compile-time error.