Invoking the Compiler from the Command Line

There are two necessary steps to invoke the Intel® C++ Compiler from the command line:

  1. Set the environment variables.

  2. Invoke the compiler with icc or ecc.

Note

You can also invoke the compiler with icpc and ecpc for C++ source files on IA-32 and Itaniun(TM)-based systems respectively. The icc and ecc compiler examples in this documentation apply to C and C++ source files.

Set the Environment Variables

Before you can operate the compiler, you must set the environment variables to specify locations for the various components. The Intel C++ Compiler installation includes shell scripts that you can use to set environment variables. From the command line, execute the shell script that corresponds to your installation. With the default compiler installation, these scripts are located at:

Running the Shell Scripts

To run the iccvars.sh script on IA-32, enter the following on the command line:

prompt>. /opt/intel/compiler50/ia32/bin/iccvars.sh

If you want the iccvars.sh to run automatically when you start Linux*, edit your .bash_profile file and add the same line to the end of your file:
 
# set up environment for Intel compiler icc
. /opt/intel/compiler50/ia32/bin/iccvars.sh

The procedure is similar for running the eccvars.sh shell script on Itanium-based systems.

Invoke the Compiler

Once the environment variables are set, you can invoke the compiler for your platform:

 
Syntax Description
options Indicates one or more command-line options. The compiler recognizes one or more letters preceded by a hyphen (-).
file1, file2 . . . Indicates one or more files to be processed by the compilation system. You can specify more than one file. Use a space as a delimiter for multiple files.
linker_options

Indicates options directed to the linker.