Compiler Options Listed by Category


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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


/O1Creates small code.
/O2Creates fast code.
/ObControls inline expansion.
/OdDisables optimization.
/OgDeprecated. Uses global optimizations.
/OiGenerates intrinsic functions.
/OsFavors small code.
/OtFavors fast code.
/OxUses maximum optimization (/Ob2gity /Gs).
/OyOmits frame pointer. (x86 only)
/favorProduces code that is optimized for a specified architecture, or for a range of architectures.

Code Generation

/archUse SSE or SSE2 instructions in code generation. (x86 only)
/clrProduces an output file to run on the common language runtime.
/EHSpecifies the model of exception handling.
/fpSpecifies floating-point behavior.
/GAOptimizes for Windows applications.
/GdUses the __cdecl calling convention. (x86 only)
/GeDeprecated. Activates stack probes.
/GFEnables string pooling.
/GhCalls hook function _penter.
/GHCalls hook function _pexit.
/GLEnables whole program optimization.
/GmEnables minimal rebuild.
/GREnables run-time type information (RTTI).
/GrUses the __fastcall calling convention. (x86 only)
/GSChecks buffer security.
/GsControls stack probes.
/GTSupports fiber safety for data allocated by using static thread-local storage.
/guard:cfAdds control flow guard security checks.
/GvUses the __vectorcall calling convention. (x86 and x64 only)
/GwEnables whole-program global data optimization.
/GXDeprecated. Enables synchronous exception handling. Use /EH instead.
/GyEnables function-level linking.
/GZDeprecated. Enables fast checks. (Same as /RTC1)
/GzUses the __stdcall calling convention. (x86 only)
/homeparamsForces 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).
/hotpatchCreates a hotpatchable image.
/Qfast_transcendentalsGenerates fast transcendentals.
QIfistDeprecated. Suppresses the call of the helper function _ftol when a conversion from a floating-point type to an integral type is required. (x86 only)
/Qimprecise_fwaitsRemoves fwait commands inside try blocks.
/QparEnables automatic parallelization of loops.
/Qpar-reportEnables reporting levels for automatic parallelization.
/Qsafe_fp_loadsUses 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.
/RTCEnables run-time error checking.
/volatileSelects how the volatile keyword is interpreted.

Output Files

/docProcesses documentation comments to an XML file.
/FAConfigures an assembly listing file.
/FaCreates an assembly listing file.
/FdRenames program database file.
/FeRenames the executable file.
/FiSpecifies the preprocessed output file name.
/FmCreates a mapfile.
/FoCreates an object file.
/FpSpecifies a precompiled header file name.
/FR /FrGenerates browser files.


/AISpecifies a directory to search to resolve file references passed to the #using directive.
/CPreserves comments during preprocessing.
/DDefines constants and macros.
/ECopies preprocessor output to standard output.
/EPCopies preprocessor output to standard output.
/FIPreprocesses the specified include file.
/FUForces the use of a file name, as if it had been passed to the #using directive.
/FxMerges injected code with the source file.
/ISearches a directory for include files.
/PWrites preprocessor output to a file.
/URemoves a predefined macro.
/uRemoves all predefined macros.
/XIgnores the standard include directory.


/openmpEnables #pragma omp in source code.
/vdSuppresses or enables hidden vtordisp class members.
/vmbUses best base for pointers to members.
/vmgUses full generality for pointers to members.
/vmmDeclares multiple inheritance.
/vmsDeclares single inheritance.
/vmvDeclares virtual inheritance.
/Z7Generates C 7.0–compatible debugging information.
/ZaDisables language extensions.
/ZcSpecifies standard behavior under /Ze.
/ZeDeprecated. Enables language extensions.
/ZIIncludes debug information in a program database compatible with Edit and Continue. (x86 only)
/ZiGenerates complete debugging information.
/ZlRemoves the default library name from the .obj file.
/Zp nPacks structure members.
/ZsChecks syntax only.
/ZWProduces an output file to run on the Windows Runtime.


/FSets stack size.
/LDCreates a dynamic-link library.
/LDdCreates a debug dynamic-link library.
/linkPasses the specified option to LINK.
/LNCreates an MSIL module.
/MDCompiles to create a multithreaded DLL, by using MSVCRT.lib.
/MDdCompiles to create a debug multithreaded DLL, by using MSVCRTD.lib.
/MTCompiles to create a multithreaded executable file, by using LIBCMT.lib.
/MTdCompiles to create a debug multithreaded executable file, by using LIBCMTD.lib.

Precompiled Header

/Y-Ignores all other precompiled-header compiler options in the current build.
/YcCreates a precompiled header file.
/YdPlaces complete debugging information in all object files.
/YuUses a precompiled header file during build.


/?Lists the compiler options.
@Specifies a response file.
/analyzeEnables code analysis.
/bigobjIncreases the number of addressable sections in an .obj file.
/cCompiles without linking.
/cgthreadsSpecifies number of cl.exe threads to use for optimization and code generation.
/errorReportEnables you to provide internal compiler error (ICE) information directly to the Visual C++ team.
/FCDisplays the full path of source code files passed to cl.exe in diagnostic text.
/FSForces writes to the program database (PDB) file to be serialized through MSPDBSRV.EXE.
/HDeprecated. Restricts the length of external (public) names.
/HELPLists the compiler options.
/JChanges the default char type.
/kernelThe compiler and linker will create a binary that can be executed in the Windows kernel.
/MPBuilds multiple source files concurrently.
/nologoSuppresses display of sign-on banner.
/sdlEnables additional security features and warnings.
/showIncludesDisplays a list of all include files during compilation.
/Tc /TCSpecifies a C source file.
/Tp /TPSpecifies a C++ source file.
/VDeprecated. Sets the version string.
/wDisables all warnings.
/W0, /W1, /W2, /W3, /W4Sets output warning level.
/w1, /w2, /w3, /w4Sets warning level for the specified warning.
/WallEnables all warnings, including warnings that are disabled by default.
/wdDisables the specified warning.
/weTreats the specified warning as an error.
/WLEnables one-line diagnostics for error and warning messages when compiling C++ source code from the command line.
/woDisplays the specified warning only once.
/Wp64Obsolete. Detects 64-bit portability problems.
/WvDisables warnings introduced by later versions of the compiler.
/WXTreats warnings as errors.
/YdDeprecated. Places complete debugging information in all object files. Use /Zi instead.
/YlInjects a PCH reference when creating a debug library.
/ZmSpecifies the precompiled header memory allocation limit.

Deprecated and Removed Compiler Options

/clr:noAssemblyDeprecated. Use /LN (Create MSIL Module) instead.
/FrDeprecated. Creates a browse information file without local variables.
/GeDeprecated. Activates stack probes. On by default.
/GXDeprecated. Enables synchronous exception handling. Use /EH instead.
/GZDeprecated. Enables fast checks. Use /RTC1 instead.
/HDeprecated. Restricts the length of external (public) names.
/OgDeprecated. Uses global optimizations.
QIfistDeprecated. Once used to specify how to convert from a floating-point type to an integral type.
/VDeprecated. Sets the .obj file version string.
/YdDeprecated. Places complete debugging information in all object files. Use /Zi instead.
/Zc:forScope-Deprecated. Disables conformance in for loop scope.
/ZeDeprecated. Enables language extensions.
/ZgRemoved in Visual C++ 2015. Generates function prototypes.

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