Set Compiler Options in the ICC Environment Variable

Frequently used command-line options can be stored in the  ICC  environment variable. This method is useful if you repeat the same command-line options every time you compile.

You can also specify source filenames in  ICC. For example, if you specify:

   SET ICC=test.c check.c

the command

   icc main.c

causes test.c, check.c, and main.c to be compiled and linked, in that order. If you specify library (.lib) or object (.obj) files in ICC, they are passed to the linker when the compiler invokes it.

Setting the ICC Environment Variable
The  ICC  environment variable can be set from the command line. Once set, the options will only be in effect for the current session (i.e. until you reboot).

For example, to specify that a source listing be generated for all compilations and that the macro DEBUG be defined to be 1, use the following command:

   SET ICC=/Ls+  /DDEBUG::1

Now, type  icc  prog1.C to compile prog1.C. The macro DEBUG is defined as 1, and a source listing is produced.

Precedence of Options
Options you specify on the command line override options in the  ICC  variable. For example, the following compiler invocation voids the effect of the  ICC setting in the last example:

    icc  /Ls- /UDEBUG fred.c

The equal sign (=) is not allowed in environment variables. For any option that includes an equal sign use a double colon (::) instead.



Set Compiler Options on the Command Line


Environment Variables for Compiling
Summary of Compiler Options