VC compiler options

Source: Internet
Author: User
Tags microsoft c intel pentium

Cl.exe is a 32-bit tool that controls Microsoft C and C ++ compilers and connectors. The compiler generates a Common Object File Format (coff) object (. OBJ) file. The linker generates an executable file (.exe) or a dynamic link library file (DLL ).

Note that all compiler options are case sensitive.

Use/C to compile but not link it.

Use nmake to generate output files.

Use BSCMAKE to support class browsing.

The following is a complete list of compiler option categories.

Optimization

Option Function
/O1 create small code
/O2 create quick code
/OA assumes no alias
/Ob control Inline expansion
/OD disabling Optimization
/Og use global optimization
/OI generate internal functions
/OP improves floating point consistency
/OS code priority
/OT code speed first
/Ow assumes that aliases are used in function calls.
/Ox maximum optimization (/ob1gity/GS)
/Oy omitting frame pointer

Code Generation

Option Function
/CLR enables C ++ managed extensions and generates output files running on the Common Language Runtime Library
/EH specifies the Exception Handling Model
/G3 optimization code to optimize the 386 processor. This option is disabled in Visual C ++ 5.0 and will be ignored by the compiler.
/G4 optimization code to optimize the 486 processor. This option is disabled in Visual C ++ 5.0 and will be ignored by the compiler.
/G5 optimization code to optimize Pentium
/GB is equivalent to/g6; Set _ m_ix86 to 600
/GD use _ cdecl call Convention
/Ge activate stack Detection
/GF
/GF enable string pool
/GH call hook function _ penter
/GH call hook function _ pexit
/GL enable full-Program Optimization
/GM enables minimum regenerate
/GR enable runtime type information (rtti)
/GR use _ fastcall call Convention
/GS control stack Detection
/GT supports fiber-path security for data allocated by the local storage area using static threads
/GX enable synchronization Exception Handling
/Gy enable function-level Link
/GZ use _ stdcall call Convention
/MD use msvcrt. lib to create multi-thread DLL
/MDD use msvcrtd. lib to create and debug multi-thread DLL
/Ml use libc. lib to create a single-thread Executable File
/MLD use libcd. lib to create and debug single-thread executable files
/MT uses libcmt. lib to create multi-thread executable files
/MTD use libcmtd. lib to create and debug multi-thread executable files

Output file

Option Function
/FA
/FA: Create a list file
Set list file name
/FD rename the program database file
/Fe rename the executable file
/FM create a ing File
/FO: Create an object file
/FP specifies the precompiled header file name
/FR
/FR generate a Browser file
/FX merge the inserted code with the source file

Debugging

Option Function
/GS buffer security check
/GZ is the same as/rtc1
/RTC enable runtime error check
/Wp64 detection of 64-bit portability
/Yd put the complete debugging information in all object files
/YL inserts a PCH reference when creating the debugging Library
/Z7 generates debugging information compatible with C 7.0
/ZD generate row number
/Zi to generate complete debugging information

Pre-processor

Option Function
/AI specifies the directory to be searched when parsing a file that is passed to the # using command
/C keep comments during preprocessing
/D defines constants and macros
/E. Copy the pre-processor output to the standard output.
/EP copies the pre-processor output to the standard output
/FL pre-processing specified include files
/Fu enforces the use of file names, just as it has been passed to the # using command
/I search for include files in the directory
/P writes the pre-processor output to a file
/U remove predefined macros
/U remove all predefined macros
/X ignore standard inclusion Directories
/Zi includes debugging information in the program database compatible with "edit and continue"

Language

Option Function
/Nobool cancel the C ++ bool, true, and false keywords
/VD cancel or enable hidden vtordisp class members
/Vmb uses the best base for pointers to members
/Vmg uses completely generic pointers to members
/Vmm declares multiple inheritance
/VMS declares single inheritance
/Vmv declares virtual inheritance
/Za disable Language extension
/ZC specifies the standard behavior under/ze
/Ze enable language Extension
/ZG generate function prototype
/ZL removes the default library name from the. OBJ file
/ZP n encapsulation structure member
/Zs only checks the syntax

Link

Option Function
/F set the stack size
/LD create dynamic link library
/LDD create and debug Dynamic Link Library
/Link: Pass the specified option to link
/MD uses msvcrt. lib to compile to create multi-threaded DLL
/MDD is compiled using msvcrtd. lib to create and debug multi-thread DLL
/Ml uses libc. lib to compile to create a single-thread Executable File
/MLD uses libcd. Lib compilation to create a single-thread executable file for debugging
/MT uses libcmt. Lib compilation to create multi-thread executable files
/MTD uses libcmtd. lib to compile and debug multi-thread executable files

Precompiled header

Option Function
/Y-ignore all other precompiled header compiler options in the current build
/YC create pre-compiled header file
/Yd put the complete debugging information in all object files
/Yu uses the pre-compiled header file during generation
/Yx automatically processes the pre-compiled Header

Miscellaneous

Option Function
@ Specify the response File
/? List compiler options
/C compilation but not linked
/H limit the length of external (public) Names
/Help list compiler options
/J. Change the default char type.
/Nologo cancel display logon copyright logo
/Qi0f ensure that the Pentium 0f command is correct
/Qifdiv fdiv, fprem, fptan, and fpatan instruction-defective Intel Pentium microprocessor workarounds
Qifist cancels the call of the Helper function _ ftol when the floating point type needs to be converted to an integer type
/Showincludes: displays the list of all included files during compilation
/TC
/TC specifies the C source file
/TP
/TP specifies the C ++ source file
/V sets the version string
/W sets the warning level
/W disable all warnings
/Wall enables all warnings, including warnings disabled by default
/WL enables single-line Diagnosis of error messages and warning messages when compiling C ++ source code from the command line
/ZM sets the compiler's memory allocation limit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.