Scope of Compiler Options

Options apply only to the source files that follow the option. The last, or rightmost, occurrence of these options is the one that is in effect for the source file or files that follow it.

In this example, the file module1.c is compiled with the option /L- because this option follows /L+:

    icc  /L+ /L- module1.c

In the next example, the file module1.c is compiled with the /L+ option, while module2.c is compiled with /L-:

    icc  /L+ module1.c /L- module2.c

Exceptions

The following options behave differently:

/D Defines a preprocessor macro. /D is different from other options in that the first definition of a macro is the one that is used. If a preprocessor macro is defined more than once, a warning appears.
/I Sets search paths for include files. This option is cumulative. If you specify the option more than once, the parameters you specify are appended to the parameters previously stated. For example, the command
    icc  /Ia: /Ib:\cde /Ic:\fgh prog.c

causes the following search path to be built:

   a:;b:\cde;c:\fgh
/B Passes options to the linker, in addition to the default options. Like /I, this option is cumulative; if you specify it more than once, the parameters you set are appended to the parameters previously stated. All options on the command line, and in environment variables, are accumulated before the object files are linked. The options apply to all object files linked.


Summary of Compiler Options
Summary of Compiler Options by Function
Options Passed to the Linker by Default