We recommend using Visual Studio 2017

Compiler Options Listed Alphabetically

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at 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.

OptionPurpose
@Specifies a response file.
/?Lists the compiler options.
/AISpecifies a directory to search to resolve file references passed to the #using directive.
/analyzeEnable code analysis.
/archSpecifies the architecture for code generation.
/bigobjIncreases the number of addressable sections in an .obj file.
/CPreserves comments during preprocessing.
/cCompiles without linking.
/cgthreadsSpecifies number of cl.exe threads to use for optimization and code generation.
/clrProduces an output file to run on the common language runtime.
/DDefines constants and macros.
/docProcess documentation comments to an XML file.
/ECopies preprocessor output to standard output.
/EHSpecifies the model of exception handling.
/EPCopies preprocessor output to standard output.
/errorReportAllows you to provide internal compiler error (ICE) information directly to the Visual C++ team.
/FSets stack size.
/favorProduces 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.
/FACreates a listing file.
/FaSets the listing file name.
/FCDisplay full path of source code files passed to cl.exe in diagnostic text.
/FdRenames program database file.
/FeRenames the executable file.
/FIPreprocesses the specified include file.
/FiSets the preprocessed output file name.
/FmCreates a mapfile.
/FoCreates an object file.
/fpSpecify floating-point behavior.
/FpSpecifies a precompiled header file name.
/FR

 /Fr
Generates browser files. /Fr is deprecated.
/FSForces writes to the program database (PDB) file to be serialized through MSPDBSRV.EXE.
/FUForces the use of a file name as if it had been passed to the #using directive.
/FxMerges injected code with source file.
/GAOptimizes code for Windows application.
/GdUses the __cdecl calling convention (x86 only).
/GeDeprecated. Activates stack probes.
/GFEnables string pooling.
/GHCalls hook function _pexit.
/GhCalls hook function _penter.
/GLEnables whole program optimization.
/GmEnables minimal rebuild.
/GREnables run-time type information (RTTI).
/GrUses the __fastcall calling convention (x86 only).
/GSBuffers security check.
/GsControls stack probes.
/GTSupports fiber safety for data allocated 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. Same as /RTC1.
/GzUses the __stdcall calling convention (x86 only).
/HDeprecated. Restricts the length of external (public) names.
/HELPLists the compiler options.
/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.
/ISearches a directory for include files.
/JChanges the default char type.
/kernelThe compiler and linker will create a binary that can be executed in the Windows kernel.
/LDCreates a dynamic-link library.
/LDdCreates a debug dynamic-link library.
/linkPasses the specified option to LINK.
/LNCreates an MSIL module.
/MDCreates a multithreaded DLL using MSVCRT.lib.
/MDdCreates a debug multithreaded DLL using MSVCRTD.lib.
/MPCompiles multiple source files by using multiple processes.
/MTCreates a multithreaded executable file using LIBCMT.lib.
/MTdCreates a debug multithreaded executable file using LIBCMTD.lib.
/nologoSuppresses display of sign-on banner.
/O1Creates small code.
/O2Creates fast code.
/ObControls inline expansion.
/OdDisables optimization.
/OgDeprecated. Uses global optimizations.
/OiGenerates intrinsic functions.
/openmpEnables #pragma omp in source code.
/OsFavors small code.
/OtFavors fast code.
/OxUses maximum optimization (/Ob2gity /Gs).
/OyOmits frame pointer (x86 only).
/PWrites preprocessor output to a file.
/Qfast_transcendentalsGenerates fast transcendentals.
/QIfistDeprecated. Suppresses _ftol when a conversion from a floating-point type to an integral type is required (x86 only).
/Qimprecise_fwaitsRemoves fwait commands inside try blocks.
/Qpar (Auto-Parallelizer)Enables automatic parallelization of loops that are marked with the #pragma loop() directive.
/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.
/sdlEnables additional security features and warnings.
/showIncludesDisplays a list of include files during compilation.
/Tc

 /TC
Specifies a C source file.
/Tp

 /TP
Specifies a C++ source file.
/URemoves a predefined macro.
/uRemoves all predefined macros.
/VDeprecated. Sets the .obj file version string.
/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.
/volatileSelects how the volatile keyword is interpreted.
/wDisables all warnings.
/W0, /W1, /W2, /W3, /W4Sets which warning level to output.
/w1, /w2, /w3, /w4Sets the 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.
/WvDisplays no warnings introduced after the specified version of the compiler.
/WXTreats all warnings as errors.
/XIgnores the standard include directory.
/Y-Ignores all other precompiled-header compiler options in the current build.
/YcCreates a precompiled header file.
/YdDeprecated. Places complete debugging information in all object files. Use /Zi instead.
/YlInjects a PCH reference when creating a debug library
/YuUses a precompiled header file during build.
/Z7Generates C 7.0–compatible debugging information.
/ZaDisables language extensions.
/ZcSpecifies standard behavior under /Ze./Za, /Ze (Disable Language Extensions)
/ZeDeprecated. Enables language extensions.
/ZgRemoved in Visual C++ 2015. Generates function prototypes.
/ZIIncludes debug information in a program database compatible with Edit and Continue.
/ZiGenerates complete debugging information.
/ZlRemoves default library name from .obj file (x86 only).
/ZmSpecifies the precompiled header memory allocation limit.
/ZpPacks structure members.
/ZsChecks syntax only.
/ZWProduces an output file to run on the Windows Runtime.

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

Show: