Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Compiler Options Listed by Category

This article contains a categorical list of compiler options. For an alphabetical list, see Compiler Options Listed Alphabetically.

Optimization

Option

Purpose

/O1

Creates small code.

/O2

Creates fast code.

/Ob

Controls inline expansion.

/Od

Disables optimization.

/Og

Uses global optimizations.

/Oi

Generates intrinsic functions.

/Os

Favors small code.

/Ot

Favors fast code.

/Ox

Uses maximum optimization (/Ob2gity /Gs).

/Oy

Omits frame pointer. (x86 only)

Code Generation

Option

Purpose

/arch

Use SSE or SSE2 instructions in code generation. (x86 only)

/bigobj

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

/clr

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

/EH

Specifies the model of exception handling.

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

/fp

Specifies floating-point behavior.

/Gd

Uses the __cdecl calling convention. (x86 only)

/Ge

Activates stack probes.

/GF

Enables string pooling.

/Gh

Calls hook function _penter.

/GH

Calls hook function _pexit.

/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

Controls stack probes.

/GT

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

/GX

Enables synchronous exception handling.

/Gy

Enables function-level linking.

/Gz

Uses the __stdcall calling convention. (x86 only)

/MD

Creates a multithreaded DLL by using MSVCRT.lib.

/MDd

Creates a debug multithreaded DLL by using MSVCRTD.lib.

/MT

Creates a multithreaded executable file by using LIBCMT.lib.

/MTd

Creates a debug multithreaded executable file by using LIBCMTD.lib.

/Qfast_transcendentals

Generates fast transcendentals.

/Qimprecise_fwaits

Removes fwait commands inside try blocks.

/Qpar

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

/Qvec-report (Auto-Vectorizer Reporting Level)

Enables reporting levels for automatic vectorization.

/ZW

Produces an output file to run on the Windows Runtime.

Output Files

Option

Purpose

/FA

Configures an assembly listing file.

/Fa

Creates an assembly listing file.

/Fd

Renames program database file.

/Fe

Renames the executable file.

/Fi

Specifies the preprocessed output file name.

/Fm

Creates a mapfile.

/Fo

Creates an object file.

/Fp

Specifies a precompiled header file name.

/FR/Fr

Generates browser files.

/Fx

Merges injected code with the source file.

Debugging

Option

Purpose

/GS

Checks buffer security.

/GZ

Same as /RTC1

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

/RTC

Enables run-time error checking.

/Wp64

Detects 64-bit portability problems.

/Yd

Places complete debugging information in all object files.

/Yl

Injects a PCH reference when creating a debug library.

/Z7

Generates C 7.0–compatible debugging information.

/Zi

Generates complete debugging information.

/ZI

Includes debug information in a program database compatible with Edit and Continue. (x86 only)

Preprocessor

Option

Purpose

/AI

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

/C

Preserves comments during preprocessing.

/D

Defines constants and macros.

/E

Copies preprocessor output to standard output.

/EP

Copies preprocessor output to standard output.

/FI

Preprocesses the specified include file.

/FU

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

/I

Searches a directory for include files.

/P

Writes preprocessor output to a file.

/U

Removes a predefined macro.

/u

Removes all predefined macros.

/X

Ignores the standard include directory.

Language

Option

Purpose

/openmp

Enables #pragma omp in source code.

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

/Za

Disables language extensions.

/Zc

Specifies standard behavior under /Ze.

/Ze

Enables language extensions.

/Zg

Generates function prototypes.

/Zl

Removes the default library name from the .obj file.

/Zpn

Packs structure members.

/Zs

Checks syntax only.

Linking

Option

Purpose

/F

Sets stack size.

/LD

Creates a dynamic-link library.

/LDd

Creates a debug dynamic-link library.

/LN

Creates an MSIL module.

/link

Passes the specified option to LINK.

/MD

Compiles to create a multithreaded DLL, by using MSVCRT.lib.

/MDd

Compiles to create a debug multithreaded DLL, by using MSVCRTD.lib.

/MT

Compiles to create a multithreaded executable file, by using LIBCMT.lib.

/MTd

Compiles to create a debug multithreaded executable file, by using LIBCMTD.lib.

Precompiled Header

Option

Purpose

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

/Yu

Uses a precompiled header file during build.

Miscellaneous

Option

Purpose

/?

Lists the compiler options.

@

Specifies a response file.

/analyze

Enables code analysis.

/c

Compiles without linking.

/doc

Processes documentation comments to an XML file.

/errorReport

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

/FC

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

/H

Restricts the length of external (public) names.

/HELP

Lists the compiler options.

/hotpatch

Creates a hotpatchable image.

/J

Changes the default char type.

/kernel

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

/MP

Builds multiple source files concurrently.

/nologo

Suppresses display of sign-on banner.

QIfist

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

/QIPF_B

Does not generate sequences of instructions that give unexpected results, according to the errata for the B CPU stepping. (IPF only)

/QIPF_C

Does not generate sequences of instructions that give unexpected results, according to the errata for the C CPU stepping. (IPF only)

/QIPF_fr32

Do not use upper 96 floating-point registers. (IPF only)

/QIPF_noPIC

Generates an image with position dependent code (IPF only).

/QIPF_restrict_plabels

Enhances performance for programs that do not create functions at runtime. (IPF only)

/sdl

Enables additional security features and warnings.

/showIncludes

Displays a list of all include files during compilation.

/Tc/TC

Specifies a C source file.

/Tp/TP

Specifies a C++ source file.

/V

Sets the version string.

/Wall

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

/W

Sets warning level.

/w

Disables all warnings.

/WL

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

/Zm

Specifies the precompiled header memory allocation limit.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.