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
  2. invoke the compiler using icc or icpc

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. With the default compiler installation, these scripts are:

To run an environment script, enter one of the following on the command line:

prompt>source /opt/intel_cc_80/bin/iccvars.sh

or

prompt>source /opt/intel_cc_80/bin/iccvars.csh

If you want the script to run automatically when you start Linux*, add the same command to the end of your startup file.

Sample .bash_profile entry for iccvars.sh:

# set environment vars for Intel C++ compiler

source /opt/intel_cc_80/bin/iccvars.sh

Invoking the Compiler with icc or icpc

You can invoke the Intel C++ Compiler on the command line with either icc or icpc. Each invocation includes the C++ run-time libraries and header files. Use the -no_cpprt option if you do not want the C++ run-time libraries and headers.

Command-line Syntax

When you invoke the Intel C++ Compiler with icc or icpc, use the following syntax:

prompt>{icc|icpc} [options] file1 [file2 . . .] [linker options]

Argument Description
options Indicates one or more command-line options. The compiler recognizes one or more letters preceded by a hyphen (-). See the Options Quick Reference
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.

Example:

prompt>icpc -prec_div -axW my_source1.cpp my_source2.cpp -Bstatic