CL Environment Variables

The CL tool uses the following environment variables:

  • CL, if defined. The CL tool processes options and arguments defined in the CL environment variable before processing the command line.

  • INCLUDE, which must point to the \include subdirectory of your Visual C++ installation.

  • LIBPATH, which specifies directories to search for metadata files referenced with #using. See #using for more information on LIBPATH.

You can set the CL environment variable using the following syntax:

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

For details on the arguments to the CL environment variable, see Compiler Command-Line Syntax.

You can use this environment variable to define the files and options you use most often and use the command line to define specific files and options for specific purposes. The CL environment variable is limited to 1024 characters (the command-line input limit).

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.

Examples

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

See Also

Reference

Setting Compiler Options

Compiler Options