The following is a comprehensive alphabetic list of compiler options. Click any option name for specific information about it. Also see the compiler options listed by category of purpose.
Option name and arguments | Purpose |
---|---|
@ | Specifies a response file. |
/? | Lists the compiler options. |
/C | Preserves comments during preprocessing |
/c | Compiles without linking |
/com+ | Enables Managed Extensions for C++ and produce an output file to run on the Universal Runtime. |
/D | Defines constants and macros |
/E | Copies preprocessor output to standard output |
/EH | Specifies the model of exception handling |
/EP | Copies preprocessor output to standard output |
/F | Sets stack size |
/FA | Creates a listing file |
/Fa | Sets listing file name |
/Fd | Renames program database file |
/Fe | Renames the executable file |
/FI | Preprocesses the specified include file |
/Fm | Creates a map file |
/Fo | Creates an object file |
/Fp | Specifies a precompiled header file name |
/FR /Fr |
Generate browser files |
/Fx | Merges injected code with source file |
/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 processor |
/G6 | Optimizes code to favor the Pentium Pro, Pentium II, and Pentium III processors |
/GA | Optimizes code for Windows application |
/GB | Optimizes code to favor the Pentium processor. Blends optimizations for the 80386 (/G3), 80486 (/G4), Pentium (/G5), and Pentium Pro, Pentium II, and Pentium III (/G6) options |
/GD | Optimizes code for Windows DLL |
/Gd | Uses the __cdecl calling convention |
/Ge | Activates stack probes |
/GF /Gf |
Enable 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 |
/GS | Buffer security check |
/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 | Same as /RTC1 |
/Gz | Uses the __stdcall calling convention |
/H | Restricts the length of external (public) names |
/HELP | Lists the compiler options |
/I | Searches a directory for include files |
/J | Changes the default char type |
/LD | Creates a dynamic-link library |
/LDd | Creates a debug dynamic-link library |
/link | Passes the specified option to LINK |
/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 |
/noBool | Suppress the C++ bool, true, and false keywords |
/noHRESULT | Suppresses implicit compiler support for HRESULT variables |
/nologo | Suppresses display of sign-on banner |
/noWchar_t | Turns wchar_t off as a native data type |
/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 (/Ob1gity /Gs) |
/Oy | Omits frame pointer |
/QI0f | Performs Pentium 0x0f erratum fix |
/QIfdiv | Performs Pentium FDIV erratum fix |
/QIfist | Suppresses _ftol when a conversion from a floating-point type to an integral type is required |
/P | Writes preprocessor output to a file |
/RTC | Enables run-time error checking |
/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 |
/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 | Inject a PCH reference when creating a debug library. |
/Yu | Uses a precompiled header file during build |
/YX | Automates precompiled header |
/Z7 | Generates C 7.0–compatible debugging information |
/Za | Disables language extensions |
/Zc (Conformance) | Specifies standard behavior under /Ze |
/Zd | Generates line numbers |
/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 |
/Zm | Sets the compiler's memory allocation limit |
/Zp | Packs structure members |
/Zs | Checks syntax only |
Building a C/C++ Program | Compiler Options | Setting Compiler Options