共用方式為


Compiler Options Listed Alphabetically

The following is a comprehensive alphabetical list of compiler options. For a categorical list, see the Compiler Options Listed by Category.

Option

Purpose

@

Specifies a response file.

/?

Lists the compiler options.

/AI

Specifies a directory to search to resolve file references passed to the #using directive.

/analyze

Enable code analysis.

/arch

Specifies the architecture for code generation.

/bigobj

Increases the number of addressable sections in an .obj file.

/C

Preserves comments during preprocessing.

/c

Compiles without linking.

/cgthreads

Specifies number of cl.exe threads to use for optimization and code generation.

/clr

Produces an output file to run on the common language runtime.

/D

Defines constants and macros.

/doc

Process documentation comments to an XML file.

/E

Copies preprocessor output to standard output.

/EH

Specifies the model of exception handling.

/EP

Copies preprocessor output to standard output.

/errorReport

Allows you to provide internal compiler error (ICE) information directly to the Visual C++ team.

/F

Sets stack size.

/favor

Produces code that is optimized for a specific x64 architecture or for the specifics of micro-architectures in both the AMD64 and Extended Memory 64 Technology (EM64T) architectures.

/FA

Creates a listing file.

/Fa

Sets the listing file name.

/FC

Display full path of source code files passed to cl.exe in diagnostic text.

/Fd

Renames program database file.

/Fe

Renames the executable file.

/FI

Preprocesses the specified include file.

/Fi

Sets the preprocessed output file name.

/Fm

Creates a mapfile.

/Fo

Creates an object file.

/fp

Specify floating-point behavior.

/Fp

Specifies a precompiled header file name.

/FR

/Fr

Generates browser files.

/FS

Forces writes to the program database (PDB) file to be serialized through MSPDBSRV.EXE.

/FU

Forces the use of a file name as if it had been passed to the #using directive.

/Fx

Merges injected code with source file.

/GA

Optimizes code for Windows application.

/Gd

Uses the __cdecl calling convention (x86 only).

/Ge

Activates stack probes.

/GF

Enables string pooling.

/GH

Calls hook function _pexit.

/Gh

Calls hook function _penter.

/GL

Enables whole program optimization.

/Gm

Enables minimal rebuild.

/GR

Enables run-time type information (RTTI).

/Gr

Uses the __fastcall calling convention (x86 only).

/GS

Buffers security check.

/Gs

Controls stack probes.

/GT

Supports fiber safety for data allocated using static thread-local storage.

/Gv

Uses the __vectorcall calling convention. (x86 and x64 only)

/Gw

Enables whole-program global data optimization.

/GX

Enables synchronous exception handling.

/Gy

Enables function-level linking.

/GZ

Same as /RTC1.

/Gz

Uses the __stdcall calling convention (x86 only).

/H

Restricts the length of external (public) names.

/HELP

Lists the compiler options.

/homeparams

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).

/hotpatch

Creates a hotpatchable image.

/I

Searches a directory for include files.

/J

Changes the default char type.

/kernel

The compiler and linker will create a binary that can be executed in the Windows kernel.

/LD

Creates a dynamic-link library.

/LDd

Creates a debug dynamic-link library.

/link

Passes the specified option to LINK.

/LN

Creates an MSIL module.

/MD

Creates a multithreaded DLL using MSVCRT.lib.

/MDd

Creates a debug multithreaded DLL using MSVCRTD.lib.

/MP

Compiles multiple source files by using multiple processes.

/MT

Creates a multithreaded executable file using LIBCMT.lib.

/MTd

Creates a debug multithreaded executable file using LIBCMTD.lib.

/nologo

Suppresses display of sign-on banner.

/O1

Creates small code.

/O2

Creates fast code.

/Ob

Controls inline expansion.

/Od

Disables optimization.

/Og

Uses global optimizations.

/Oi

Generates intrinsic functions.

/openmp

Enables #pragma omp in source code.

/Os

Favors small code.

/Ot

Favors fast code.

/Ox

Uses maximum optimization (/Ob2gity /Gs).

/Oy

Omits frame pointer (x86 only).

/P

Writes preprocessor output to a file.

/Qfast_transcendentals

Generates fast transcendentals.

/QIfist

Suppresses _ftol when a conversion from a floating-point type to an integral type is required (x86 only).

/Qimprecise_fwaits

Removes fwait commands inside try blocks.

/Qpar (Auto-Parallelizer)

Enables automatic parallelization of loops that are marked with the #pragma loop() directive.

/Qsafe_fp_loads

Uses integer move instructions for floating-point values and disables certain floating point load optimizations.

/Qvec-report (Auto-Vectorizer Reporting Level)

Enables reporting levels for automatic vectorization.

/RTC

Enables run-time error checking.

/sdl

Enables additional security features and warnings.

/showIncludes

Displays a list of include files during compilation.

/Tc

/TC

Specifies a C source file.

/Tp

/TP

Specifies a C++ source file.

/U

Removes a predefined macro.

/u

Removes all predefined macros.

/V

Sets the version string.

/vd

Suppresses or enables hidden vtordisp class members.

/vmb

Uses best base for pointers to members.

/vmg

Uses full generality for pointers to members.

/vmm

Declares multiple inheritance.

/vms

Declares single inheritance.

/vmv

Declares virtual inheritance.

/volatile

Selects how the volatile keyword is interpreted.

/W

Sets warning level.

/w

Disables all warnings.

/Wall

Enables all warnings, including warnings that are disabled by default.

/WL

Enables one-line diagnostics for error and warning messages when compiling C++ source code from the command line.

/Wp64

Detects 64-bit portability problems.

/X

Ignores the standard include directory.

/Y-

Ignores all other precompiled-header compiler options in the current build.

/Yc

Creates a precompiled header file.

/Yd

Places complete debugging information in all object files.

/Yl

Injects a PCH reference when creating a debug library

/Yu

Uses a precompiled header file during build.

/Z7

Generates C 7.0–compatible debugging information.

/Za

Disables language extensions.

/Zc

Specifies standard behavior under /Ze./Za, /Ze (Disable Language Extensions)

/Ze

Enables language extensions.

/Zg

Generates function prototypes.

/ZI

Includes debug information in a program database compatible with Edit and Continue.

/Zi

Generates complete debugging information.

/Zl

Removes default library name from .obj file (x86 only).

/Zm

Specifies the precompiled header memory allocation limit.

/Zo

Generate enhanced debugging information for optimized code in non-debug builds.

/Zp

Packs structure members.

/Zs

Checks syntax only.

/ZW

Produces an output file to run on the Windows Runtime.

See Also

Reference

Compiler Options

Setting Compiler Options

Other Resources

C/C++ Building Reference