次の方法で共有


Compiler Reference

OverviewHow Do I

CL.EXE is a 32-bit tool that controls the Microsoft C and C++ compilers and linker. The compilers produce Common Object File Format (COFF) object (.OBJ) files. The linker produces executable (.EXE) files or dynamic-link libraries (DLLs).

For information on specifying options, see Set Compiler Options. Other topics covered in this section are Fast Compilation and CL Invokes the Linker.

To compile without linking, use /c on the command line or click the Compile command on the Build menu.

The following is a comprehensive, alphabetic list of options for the compiler (CL.EXE). Click any option name for specific information about it. Also see the compiler options listed by category of purpose.

Option name and arguments Purpose
/C Preserves comments during preprocessing
/c Compiles without linking
/Dname[= | # [{string | number}] ] Defines constants and macros
/E Copies preprocessor output to standard output
/EH{s|a}[c][-] Specifies the model of exception handling
/EP Copies preprocessor output to standard output
/Fnumber Sets stack size
/FA[c|s] Creates a listing file
/Fa Sets listing file name
/Fdfilename Renames program database file
/FD Generate file dependencies
/Fefilename Renames the executable file
/FIfilename Preprocesses the specified include 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
/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 processor
/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 Optimizes code for Windows DLL
/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 Catch release-build errors in debug build
/Gz Uses the __stdcall calling convention
/Hnumber Restricts the length of external (public) names
/HELP Lists the compiler options
/Idirectory 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
/linkoption 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
/nologo Suppresses display of sign-on banner
/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
/Qlf Generates additional debugging information for kernal-mode device drivers.
/QI0f Performs Pentium 0x0f erratum fix
/QIfdiv[–] Performs Pentium FDIV erratum fix
/P Writes preprocessor output to a file
/Tcfilename
/TC
Specifies a C source file
/Tpfilename
/TP
Specifies a C++ source file
/Usymbol Removes a predefined macro
/u Removes all predefined macros
/V Sets the version string
/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
/Wlevel Sets warning level
/w Disables all warnings
/X Ignores the standard include directory
/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
/Z7 Generates C 7.0–compatible debugging information
/Za Disables language extensions
/Zd Generates line numbers
/Ze Enables language extensions
/Zg Generates function prototypes
/Zi Generates complete debugging information
/ZI Includes debug information in a program database compatible with Edit and Continue.
/Zl Removes default library name from .OBJ file
/Zmnumber Sets the compiler's memory allocation limit
/Zn Turns off SBRPACK for .SBR files
/Zpn Packs structure members
/Zs Checks syntax only