https://msdn.microsoft.com/zh-cn/library/9s7c9wdw.aspx
https://msdn.microsoft.com/zh-cn/library/fwkeyyhe.aspx
https://msdn.microsoft.com/zh-cn/library/19z1t1wy.aspx
This article contains a categorical list of compiler options.For an alphabetical list, see 按字母顺序列出的编译器选项.
Optimization
Option | Purpose |
---|---|
Creates small code. | |
Creates fast code. | |
Controls inline expansion. | |
Disables optimization. | |
Uses global optimizations. | |
Generates intrinsic functions. | |
Favors small code. | |
Favors fast code. | |
Uses maximum optimization (/Ob2gity /Gs). | |
Omits frame pointer.(x86 only) | |
Produces code that is optimized for a specified architecture, or for a range of architectures. |
Code Generation
Option | Purpose |
---|---|
Use SSE or SSE2 instructions in code generation.(x86 only) | |
Produces an output file to run on the common language runtime. | |
Specifies the model of exception handling. | |
Specifies floating-point behavior. | |
Optimizes for Windows applications. | |
Uses the __cdecl calling convention.(x86 only) | |
Activates stack probes. | |
Enables string pooling. | |
Calls hook function _penter. | |
Calls hook function _pexit. | |
Enables whole program optimization. | |
Enables minimal rebuild. | |
Enables run-time type information (RTTI). | |
Uses the __fastcall calling convention.(x86 only) | |
Checks buffer security. | |
Controls stack probes. | |
Supports fiber safety for data allocated by using static thread-local storage. | |
Adds control flow guard security checks. | |
Uses the __vectorcall calling convention.(x86 and x64 only) | |
Enables whole-program global data optimization. | |
Enables synchronous exception handling. | |
Enables function-level linking. | |
Enables fast checks.(Same as /RTC1) | |
Uses the __stdcall calling convention.(x86 only) | |
Forces parameters passed in registers to be written to their locations on the stack upon function entry.This compiler option is only for the x64 compilers (native and cross compile). | |
Creates a hotpatchable image. | |
Generates fast transcendentals. | |
Suppresses the call of the helper function _ftol when a conversion from a floating-point type to an integral type is required.(x86 only) | |
Removes fwait commands inside try blocks. | |
Enables automatic parallelization of loops. | |
Enables reporting levels for automatic parallelization. | |
Uses integer move instructions for floating-point values and disables certain floating point load optimizations. | |
Enables reporting levels for automatic vectorization. | |
Enables run-time error checking. | |
Selects how the volatile keyword is interpreted. |
Output Files
Option | Purpose |
---|---|
Processes documentation comments to an XML file. | |
Configures an assembly listing file. | |
Creates an assembly listing file. | |
Renames program database file. | |
Renames the executable file. | |
Specifies the preprocessed output file name. | |
Creates a mapfile. | |
Creates an object file. | |
Specifies a precompiled header file name. | |
Generates browser files. |
Preprocessor
Option | Purpose |
---|---|
Specifies a directory to search to resolve file references passed to the #using directive. | |
Preserves comments during preprocessing. | |
Defines constants and macros. | |
Copies preprocessor output to standard output. | |
Copies preprocessor output to standard output. | |
Preprocesses the specified include file. | |
Forces the use of a file name, as if it had been passed to the #using directive. | |
Merges injected code with the source file. | |
Searches a directory for include files. | |
Writes preprocessor output to a file. | |
Removes a predefined macro. | |
Removes all predefined macros. | |
Ignores the standard include directory. |
Language
Option | Purpose |
---|---|
Enables #pragma omp in source code. | |
Suppresses or enables hidden vtordisp class members. | |
Uses best base for pointers to members. | |
Uses full generality for pointers to members. | |
Declares multiple inheritance. | |
Declares single inheritance. | |
Declares virtual inheritance. | |
Generates C 7.0–compatible debugging information. | |
Disables language extensions. | |
Specifies standard behavior under /Ze. | |
Enables language extensions. | |
Generates function prototypes. | |
Includes debug information in a program database compatible with Edit and Continue.(x86 only) | |
Generates complete debugging information. | |
Removes the default library name from the .obj file. | |
/Zp n | Packs structure members. |
Checks syntax only. | |
Produces an output file to run on the Windows Runtime. |
Linking
Option | Purpose |
---|---|
Sets stack size. | |
Creates a dynamic-link library. | |
Creates a debug dynamic-link library. | |
Passes the specified option to LINK. | |
Creates an MSIL module. | |
Compiles to create a multithreaded DLL, by using MSVCRT.lib. | |
Compiles to create a debug multithreaded DLL, by using MSVCRTD.lib. | |
Compiles to create a multithreaded executable file, by using LIBCMT.lib. | |
Compiles to create a debug multithreaded executable file, by using LIBCMTD.lib. |
Precompiled Header
Option | Purpose |
---|---|
Ignores all other precompiled-header compiler options in the current build. | |
Creates a precompiled header file. | |
Places complete debugging information in all object files. | |
Uses a precompiled header file during build. |
Miscellaneous
Option | Purpose |
---|---|
Lists the compiler options. | |
Specifies a response file. | |
Enables code analysis. | |
Increases the number of addressable sections in an .obj file. | |
Compiles without linking. | |
Specifies number of cl.exe threads to use for optimization and code generation. | |
Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. | |
Displays the full path of source code files passed to cl.exe in diagnostic text. | |
Forces writes to the program database (PDB) file to be serialized through MSPDBSRV.EXE. | |
Restricts the length of external (public) names. | |
Lists the compiler options. | |
Changes the default char type. | |
The compiler and linker will create a binary that can be executed in the Windows kernel. | |
Builds multiple source files concurrently. | |
Suppresses display of sign-on banner. | |
Enables additional security features and warnings. | |
Displays a list of all include files during compilation. | |
Specifies a C source file. | |
Specifies a C++ source file. | |
Sets the version string. | |
Enables all warnings, including warnings that are disabled by default. | |
Sets warning level. | |
Disables all warnings. | |
Enables one-line diagnostics for error and warning messages when compiling C++ source code from the command line. | |
Detects 64-bit portability problems. | |
Places complete debugging information in all object files. | |
Injects a PCH reference when creating a debug library. | |
Specifies the precompiled header memory allocation limit. |