次の方法で共有


CL Environment Variable

OverviewDetails

Use the CL environment variable to specify files and options without giving them on the command line. The CL environment variable has the following syntax:

SET CL=[ [option] ... [file] ...] [/link link-opt ...]

The CL environment variable is useful if you often specify a large number of files and options when you compile. You can define the files and options you use most often with the CL variable and give only the files and options you need for specific purposes on the command line. The CL environment variable is currently limited to 1024 characters — the command-line input limit in Windows NT.

You cannot use the /D option to define a symbol that uses an equal sign (=). You can substitute the number sign (#) for an equal sign. In this way, you can use the CL environment variable to define preprocessor constants with explicit values (for example, /DDEBUG#1).

For related information, see Set Environment Variables.

Example

The following example of a CL environment variable setting:

SET CL=/Zp2 /Ox /I\INCLUDE\MYINCLS \LIB\BINMODE.OBJ

is equivalent to the following CL command:

CL /Zp2 /Ox /I\INCLUDE\MYINCLS \LIB\BINMODE.OBJ INPUT.C

The following example causes CL to compile the source files FILE1.C and FILE2.C, and then link the object files FILE1.OBJ, FILE2.OBJ, and FILE3.OBJ:

SET CL=FILE1.C FILE2.C
CL FILE3.OBJ

This has the same effect as the following command line:

CL FILE1.C FILE2.C FILE3.OBJ