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. The linker generates an executable file (.exe) or a dynamic link library file (DLL ).
Note that all compiler options are case sensitive.
The usage is as follows:
Cl [option...] file... [Option | file]... [Lib...] [@ command-file]
[/Link-opt...]
Option: one or more Cl options. Note that all options are applied to all specified source files. The
A forward slash (/) or A hyphen. If an option has a parameter, the description of this option refers
Whether spaces are allowed between options and parameters. The option name (except for the/help option) is case sensitive. Related
For more information, see the order of CL options.
/C: compiled but not linked
/Zs: Check the syntax
/? : List compiler options
/Arch: Use the SSE or sse2 command to generate code
/Arch: sse2
/CLR: Enable the C ++ hosting extension and generate output files running on the Common Language Runtime Library
/F: Set the stack size | this option sets the program stack size (in bytes ).
If this option is not used, the default stack size is 1 MB.
/F 100
/Fe: Rename the executable file
/Feexe.exe
/G7: Code optimized for Pentium 4 or athlon.
/GA: optimizes the code of Windows applications.
/GL: enable full-Program Optimization
/GM: Minimum regenerate Enabled
/Help: List compiler options
/I: Search for include files in the directory | specify the source file directory include
/I "E: \ Vc \ include"
/Link: Pass the specified option to link
/MD: Use msvcrt. lib to create multi-thread DLL
/Ml: Use libc. lib to create a single-thread Executable File
/MT: Use libcmt. lib to create multi-thread executable files
/O1: create small code
/O2: create quick code
/OS: code size first
/W: Set the warning level
/W3
------------------------------
/OT: Code speed first
/Ld: create a dynamic link library
/Ox: Maximum Optimization
/Zs: only check the syntax
------------------------------
/TC: Specifies the C source file
/TP: Specifies the C ++ source file
Bytes -----------------------------------------------------------------------------------------
File: the name of one or more source files,. OBJ files, or libraries. CL compiles the source file and name the. OBJ file and library.
The name is passed to the linker. For more information, see CL file name syntax.
Lib: name of one or more databases. CL passes these names to the linker.
Command-file: a file that 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
Bytes ---------------------------------------------------------------------------------------------
Classic usage:
Cl *. CPP/G7/MD/Ox/OT/W3/C/ehs/ I "G: \ VISUAL C ++ \ vc98 \ platformsdk \ include"
Bytes ---------------------------------------------------------------------------------------------
Link links common object file formats (coff) object files with libraries to create 32-bit executable (.exe) files or Dynamic Links
Library (DLL) 32-Bit Tool.
Link usage:
/Align specifies the alignment of each section
The/align option specifies the alignment of each section in the linear address space of the program. The number parameter is in bytes and must be a power of 2. The default value is 4 K (4096 ). If alignment is generated
If the image is invalid, the linker issues a warning. Unless
Compile an application such as a device driver. Otherwise, you do not need to modify the alignment mode.
/DLL generation DLL
/Driver: Create a driver in Windows NT core Mode
/Exetype generate Virtual Device Driver
/Exetype: Dynamic creates a Dynamically Loaded Virtual Device Driver.
/Exetype: dev386 creates a statically loaded Virtual Device Driver. This is the default value of/exetype.
/Incremental control incremental links
/Largeaddressaware notifies the compiler application to support addresses larger than 2 GB
/Libpath allows the user to override the Environment library path
/Libpath: "E: \ Vc \ Lib"/libpath: "E: \ DX \ Lib"
/Machine: Specify the Target Platform
'/Machine: {am33 | arm | EBC | IA64 | m32r | MIPS | mips16 | mipsfpu | mipsfp16|
Mipsr41xx | SH3 | sh3dsp | sh4 | sh5 | thumb | x86 | x64/* 8.0 */}
/Machine: x86
/Noentry create pure resource DLL
The/noentry option is required when a pure resource DLL is created.
/OPT control link optimization
If you generate components that only run on Windows NT or Windows 2000, use/OPT: nowin98.
/Subsystem: Specify the subsystem
{Console | efi_application | efi_boot_service_driver |
Efi_rom | efi_runtime_driver | native | POSIX | Windows |
WindowsCE} [, # [. #]
/Out specifies the output file name
/Out: hello.exe
Classic usage:
Link *. obj rc. res/libpath: "G: \ visual c ++ \ Lib"/subsystem: Windows/machine: x86 kernel32.lib user32.lib gdi32.lib winspool. lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib UUID. lib odbc32.lib odbccp32.lib opengl32.lib
RC is resource Compilation
/L list the regions used by the Resource
0x804 China
0x409 USA
Usage:
RC/L 0x804 file. RC
Bytes ---------------------------------------------------------------------------------------------
The development of MFC is as follows:
Compile source code:
Cl *. CPP/Ox/OT/G7/D "Win32"/D "_ WINDOWS"/D "_ afxdll"/ESCs/MD/arch: sse2/W3/C
Resource Compilation:
RC/L 0x804 winmfc. RC
Link:
Link *. OBJ winmfc. Res/out: winmfc.exe/OPT: nowin98/subsystem: Windows/machine: x86