Cl.exe in vcss

Source: Internet
Author: User
Tags microsoft c intel pentium

Introduction to cl.exe command parameters in vcpus (reprinted, some verified in vs2005)
The folder in which cl.exe is located contains a batch called
Vsvar32.bat
First, you can use cl.exe to compile your code.
(This file is not found in vs2005. It is suspected that it is the vcvarsall. bat of the parent directory, but the command line compilation can be performed without executing this file .)
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 an assembly 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

The CL command line uses the following syntax:

Cl [option...] file... [Option | file]... [Lib...] [@ command-file] [/link-opt...]

The following table describes the meaning of the entered CL command.

Option one or more Cl options. Note that all options are applied to all specified source files. The options are specified by a forward slash (/) or A hyphen. If an option has a parameter, the description of this option specifies whether spaces are allowed between the option and the parameter. The option name (except for the/help option) is case sensitive. For more information, see the order of CL options.

The name of one or more source files,. OBJ files, or libraries. CL compiles the source file and passes the. OBJ file and library name to the linker. For more information, see CL file name syntax.

One or more library names in Lib. CL passes these names to the linker.

Command-file contains multiple options and file names. For more information, see the CL command file.

Link-opt one or more Linker Options. CL passes these options to the linker.

You can specify any number of options, file names, and database names. The condition is that the number of characters on the command line cannot exceed 1024, which is specified by the operating system.

For the CL command file, see
Set compiler options | compiler options
A command file is a text file that contains the options and file names that you type on the command line or use Cl environment variables to specify. CL accepts the compiler command file that is used as a parameter in CL environment variables or on the command line. Different from the command line or CL environment variables, the command file allows multiple-line options and file names.

The options and file names in the command file will be processed according to the location of the command file name in the CL environment variable or on the command line. However, if the/link option appears in the command file, all options for the remaining part of the line will be passed to the linker. The options in the following lines of the command file and the options after the command file is called on the command line are still accepted as compiler options.

The command file must not contain the CL command. Each option must start and end on the same line. You cannot use a backslash (/) to combine an option across rows.

The command file is specified with a @ character followed by a file name. The file name can specify an absolute or relative path.
Article Source: http://www.diybl.com/course/3_program/vc/vc_js/200899/140233.html

 

This article from the csdn blog, reprinted Source: http://blog.csdn.net/autumn200005/archive/2009/06/22/4290150.aspx

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.