Compiler Options Listed by Category
Optimization:
/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 |
Code Generation:
/EH{s|a}[c][-] | 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 |
/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 (/G6) options. |
/Gd | Uses the __cdecl calling convention |
/Ge | Activates stack probes |
/GF /Gf |
Enable string pooling |
/Gh | Calls hook function, __penter |
/Gi | Enables incremental compilation |
/Gm | Enables minimal rebuild |
/GR | Enables run-time type information (RTTI) |
/Gr | Uses the __fastcall calling convention |
/Gssize | 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:
/FA[c|s] /Fa |
Creates a listing file Sets listing file name |
/Fdfilename | Renames program database file |
/FD | Generate file dependencies |
/Fefilename | Renames the executable file |
/Fm[filename] | Creates a map file |
/Fofilename | Creates an object file |
/Fpfilename | Specifies a precompiled header file name |
/FR[filename] /Fr[filename] |
Generate browser files |
Debugging:
/Qlf | Generates additional debugging information for kernal-mode device drivers. |
/GZ | Catch release-build errors in debug build |
/Yd | Places complete debugging information in all object files |
/Z7 | Generates C 7.0–compatible debugging information |
/Zd | Generates line numbers |
/Zi | Generates complete debugging information |
Preprocessor:
/C | Preserves comments during preprocessing |
/Dname[= | # [{string | number}] ] | Defines constants and macros |
/E | Copies preprocessor output to standard output |
/EP | Copies preprocessor output to standard output |
/Flfilename | Preprocesses the specified include file |
/Idirectory | Searches a directory for include files |
/P | Writes preprocessor output to a file |
/Usymbol | 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. |
Language:
/vd{0|1} | 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 |
/Ze | Enables language extensions |
/Zg | Generates function prototypes |
/Zl | Removes default library name from .OBJ file |
/Zpn | Packs structure members |
/Zs | Checks syntax only |
Linking:
/Fnumber | Sets stack size |
/LD | Creates a dynamic-link library |
/LDd | Creates a debug dynamic-link library |
/linkoption | 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 Files:
/Yc[filename] | Creates a precompiled header file |
/Yd | Places complete debugging information in all object files |
/Yu[filename] | Uses a precompiled header file during build |
/YX | Automates precompiled header |
Miscellaneous:
/c | Compiles without linking |
/Hnumber | 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 |
/Tcfilename /TC |
Specifies a C source file |
/Tpfilename /TP |
Specifies a C++ source file |
/V | Sets the version string |
/Wlevel /w |
Sets warning level |
/Zmnumber | Sets the compiler's memory allocation limit |
/Zn | Turns off SBRPACK for .SBR files |