Partager via


General-Purpose Compiler Options

The following table shows the compiler options.

Option Description
/? Displays the available compiler options with descriptions.
/C - Preserve Comments During Preprocessing Preserves comments during preprocessing.
/c - Compile Without Linking Compiles without linking.
/callcap -Enable callcap profiling Inserts callcap profiling hooks at the beginning and end of each function.
/D - Define Constants and Macros Defines constants and macros.
/E - Copy Preprocessor Output Copies preprocessor output to standard output.
/EH - Exception Handling Model Specifies the model of exception handling.
/EP - Copy Preprocessor Output Copies preprocessor output to standard output.
/F - Set Stack Size Sets stack size.
/Fa - Rename Assembly-File Listing Renames assembler file listing. For more information about setting file types, see File Alternatives.
/FA - Create Listing Files Creates assembler, machine, or source listing file. For more information about setting file types, see File Alternatives.
/fastcap - Enable fastcap profiling Inserts fastcap profiling hooks before and after each function call.
/Fd - Rename .PDB File Renames program database.
/Fe - Rename Executable File Renames executable file. For more information about setting file types, see File Alternatives.
/FI - Preprocess specified Header File First Preprocess specified header file first.
/Fm - Create Map File Creates map file. For more information about setting file types, see File Alternatives.
/Fo - Rename Object File Renames object file. For more information about setting file types, see File Alternatives.
/Fp - Specify Precompiled Header Specifies precompiled header file name. For more information about setting file types, see File Alternatives.
/FR, /Fr - Generate Browser Files Generates browser files. For more information about setting file types, see File Alternatives.
/GF - Enable Read-Only String Pooling Enables read-only string pooling.
/GR - Enable Run-Time Type Information Enables Run Time Type Information (RTTI).
/Gt - Use Common Global Data Area Enables global pointer relative addressing for global variables.
/GX - Enable Exception Handling Enables C++ exceptions.
/Gy - Enable Function-Level Linking Enables function-level linking.
/GZ - Catch Release Errors in Debug Build Enables run-time checks to catch bugs that only occur in a Release build while in a Debug build mode.
/H - Restrict Length of External Names Restricts length of external names.
/HELP - List the Compiler Options Lists the compiler options.
/I - Search Directory for Include Files Searches directory for include files.
/J - Change Default char Type Changes default character type.
/LD - Create a Dynamic-Link Library Creates a dynamic-link library.
/Ld, /Lw - Control Library Selection Controls library selection.
/link - Linker-Control Options Sets Linker-control options.
/nobool - Disable Bool Keyword Suppresses the C++ bool, true, and false keywords.
/nologo - Suppress Display of Sign-on Banner Suppresses display of sign-on banner.
/O1, /O2 - Specify Small or Fast Code Specifies small or fast code.
/Oa - Assume No Aliasing Assumes no aliasing.
/Obn - Control Inline Expansion Controls inline expansion, where n is a digit from 0 through 2.
/Od - Disable Optimization Disables optimization.
/Og - Enable Global Optimization Enables global optimization.
/Oi[-] - Generate Intrinsic Functions Generates intrinsic functions.
/Op[-] - Improve Floating-Point Consistency Improves floating-point consistency.
/Os, /O, /Ot - Optimize for Size or Speed Specifies small or fast sequences of machine code.
/Ow - Assume Aliasing Across Function Calls Assumes aliasing across function calls.
/Ox - Use Maximum Optimization for Speed Uses maximum optimization for fast code.
/P - Create Preprocessor Output File Creates preprocessor-output file.
/TcFilename, /TC - Specify C Source File /TcFilename compiles Filename as a C source file.

/TC compiles all files as C source files.

/TpFilename, /TP - Specify C++ Source File /TpFilename compiles Filename as a C++ source file.

/TP compiles all files as C++ source files.

/UName, /u - Remove Predefined Names /UName removes predefined macro.

/u removes all predefined macros.

/vdn - Suppress or Enable Virtual Base Class Suppresses or enables hidden vtordisp class members.
/vmb - Use Best Case for Pointers Uses best case for pointers to class members.
/vmg - Use Full Generality for Pointers Uses full generality for pointers to class members.
/vmm - Declare Multiple Inheritance Declares multiple inheritances.
/vms - Declare Single Inheritance Declares single inheritance.
/vmv - Declare Virtual Inheritance Declares virtual inheritance.
/V - Set Version String Sets version string.
/Wn, /w - Set Warning Level /Wn sets warning level to n, default is 1.

/WX treats warnings as errors.

/w disables all warnings.

/X - Ignore Standard Include Directory Ignores standard include directory.
/Yc - Create Precompiled Header Creates precompiled header.
/Yd - Duplicate Debugging Info Duplicates debugging information in all object files.
/Yu - Use Precompiled Header Uses precompiled header.
/YX - Automate Precompiled Header Automates precompiled header.
/Za - Disable Language Extensions Disables Microsoft C++ extensions and compile for ANSI compatibility.
/Zd, /Z7, /Zi -Debug Info Generates debugging information.
/Ze - Enable Language Extensions Enables Microsoft C++ language extensions.
/Zg - Generate Function Prototypes Generates function prototypes.
/Zl - Remove Default-Library Name from Object File Removes default-library names from object file.
/Zm - Specify Memory Allocation Limit Determines the compiler memory allocation limit.
/Zp[n] - Pack Structure Members Packs structure members on byte boundary specified by n.
/Zs - Check Syntax Only Checks syntax only.

See Also

Compiler Options | ARM-specific Options | Hitachi-specific Options | MIPS-specific Options | File Alternatives | Output File Redirection

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.