The CL command line has the following format:
CL [[option...]] file... [[option|file]]... [[lib...]] [[/link link-opt...]]
The following list describes input to the CL command:
Entry | Meaning |
option | One or more CL options; see “CL Options” on page 488 for descriptions. |
file | The name of one or more source files, object files, or libraries. You must specify at least one filename. CL compiles source files and passes the names of the object files and libraries to the linker. |
lib | One or more library names. CL passes the names of these libraries to the linker for processing. |
link-opt | One or more of the linker options described in Chapter 14, “Linking Object Files with LINK.” The CL command passes these options to the linker for processing. |
You can specify any number of options, filenames, and library names, as long as the length of the command line does not exceed the limit dictated by the operating system.
A filename can contain any combination of uppercase and lowercase letters, hyphens, underscores, and a period. Any filename can include a full or partial path. A full path includes a drive name of the form D: and one or more directory names separated by backslashes (\). A partial path omits the drive name, which CL assumes to be the current drive. If you don't specify any path, CL assumes the file is in the current directory.
CL determines how to process each file depending on its filename extension, as follows:
Extension | Processing |
.C | CL assumes the file is a C source file and compiles it. |
.CXX, .CPP | CL assumes the file is a C++ source file and compiles it. |
.OBJ | CL assumes the file is an object file and passes its name to the linker. |
.LIB | CL assumes the file is a library and passes its name to the linker. The linker links this library with the object files CL created from source files and the object files given on the command line. |
.ASM | CL assumes the file is an assembly file and invokes MASM (ML.EXE) to assemble it. |
.DEF | CL assumes the file is a definition file and passes its name to the linker. |
Any other extension or no extension | CL assumes the file is an object file and passes its name to the linker. |