Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Options Listed by Category
Collapse the table of content
Expand the table of content

Compiler Options Listed by Category

The following is a comprehensive categorical list of compiler options. For an alphabetical list, see Compiler Options Listed Alphabetically.


Option Purpose
/O1 Creates small code
/O2 Creates fast code
/Oa Assumes no aliasing
/Ob Controls inline expansion
/Od Disables optimization
/Og Uses global optimizations
/Oi Generates intrinsic functions
/Op Improves floating-point consistency
/Os Favors small code
/Ot Favors fast code
/Ow Assumes aliasing across function calls
/Ox Uses maximum optimization (/Ob2gity /Gs)
/Oy Omits frame pointer

Code Generation

Option Purpose
/arch Use SSE or SSE2 instructions in code generation
/clr Enables Managed Extensions for C++ and produces an output file to run on the common language runtime
/EH Specifies the model of exception handling
/G3 Optimizes code to favor the 386 processor. Phased out in Visual C++ 5.0, the compiler will ignore this option
/G4 Optimizes code to favor the 486 processor. Phased out in Visual C++ 5.0, the compiler will ignore this option
/G5 Optimizes code to favor the Pentium
/G6 Optimizes code to favor the Pentium Pro, Pentium II, and Pentium III processors
/G7 Optimizes code to favor the Pentium 4 or Athlon.
/GB Equivalent to /G6; sets the value of _M_IX86 to 600
/Gd Uses the __cdecl calling convention
/Ge Activates stack probes
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
/Gs Controls stack probes
/GT Supports fiber safety for data allocated using static thread-local storage
/GX Enables synchronous exception handling
/Gy Enables function-level linking
/Gz Uses the __stdcall calling convention
/MD Creates a multithreaded DLL using MSVCRT.lib
/MDd Creates a debug multithreaded DLL using MSVCRTD.lib
/ML Creates a single-threaded executable file using LIBC.lib
/MLd Creates a debug single-threaded executable file using LIBCD.lib
/MT Creates a multithreaded executable file using LIBCMT.lib
/MTd Creates a debug multithreaded executable file using LIBCMTD.lib

Output Files

Option Purpose
Creates a listing file
Sets listing file name
/Fd Renames program database file
/Fe Renames the executable file
/Fm Creates a mapfile
/Fo Creates an object file
/Fp Specifies a precompiled header file name
Generates browser files
/Fx Merges injected code with source file


Option Purpose
/GS Buffers security check
/GZ Same as /RTC1
/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
/Zd Generates line numbers
/Zi Generates complete debugging information


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
/Fl 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
/ZI Includes debug information in a program database compatible with Edit and Continue


Option Purpose
/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
/Za Disables language extensions
/Zc Specifies standard behavior under /Ze
/Ze Enables language extensions
/Zg Generates function prototypes
/Zl Removes default library name from .obj file
/Zpn Packs structure members
/Zs Checks syntax only


Option Purpose
/F Sets stack size
/LD Creates a dynamic-link library
/LDd Creates a debug dynamic-link library
/link Passes the specified option to LINK
/MD Compiles to create a multithreaded DLL, using MSVCRT.lib
/MDd Compiles to create a debug multithreaded DLL, using MSVCRTD.lib
/ML Compiles to create a single-threaded executable file, using LIBC.lib
/MLd Compiles to create a debug single-threaded executable file, using LIBCD.lib
/MT Compiles to create a multithreaded executable file, using LIBCMT.lib
/MTd Compiles to create a debug multithreaded executable file, 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
/YX Automates precompiled header


Option Purpose
@ Specifies a response file
/? Lists the compiler options
/c Compiles without linking
/H Restricts the length of external (public) names
/HELP Lists the compiler options
/J Changes the default char type
/nologo Suppresses display of sign-on banner
/QI0f Ensures no problems with Pentium 0F instructions
/QIfdiv Workaround for the Intel Pentium microprocessors with flawed FDIV, FPREM, FPTAN, and FPATAN instructions
QIfist Suppresses the call of the helper function _ftol when a conversion from a floating-point type to an integral type is required
/showIncludes Displays a list of all include files during compilation
Specifies a C source file
Specifies a C++ source file
/V Sets the version string
/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
/Zm Specifies the precompiled header memory allocation limit

See Also

C/C++ Building Reference | Compiler Options | Setting Compiler Options

© 2015 Microsoft