There are two necessary steps to invoke the IntelĀ® C++ Compiler from the command line:
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 "source" to set environment variables. With the default compiler installation, these scripts are:
<install-dir>/bin/iccvars.sh <arg>
or
<install-dir>/bin/iccvars.csh <arg>
The scripts take an argument specifying architecture:
ia32: Compiler and libraries for IA-32 architectures only
intel64: Compiler and libraries for IntelĀ® 64 architectures only
ia64: Compiler and libraries for IA-64 architectures only
To source an environment script, enter one of the following on the command line:
source <install-dir>/bin/iccvars.sh <arg>
or
source <install-dir>/bin/iccvars.csh <arg>
If you want the script to run automatically, 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 <install-dr>/bin/iccvars.sh ia32
With some Linux* distributions, if you source iccvars.sh from your .bash_profile, the location of LIBRARY_PATH may not be set as you would expect. It may be necessary to source iccvars.sh after starting your terminal session. This affects the Intel C++ compiler (icpc) only.
You can invoke the Intel C++ Compiler on the command line with either icc or icpc.
When you invoke the compiler with icc, the compiler builds C source files using C libraries and C include files. If you use icc with a C++ source file, it is compiled as a C++ file. Use icc to link C object files.
When you invoke the compiler with icpc the compiler builds C++ source files using C++ libraries and C++ include files. If you use icpc with a C source file, it is compiled as a C++ file. Use icpc to link C++ object files.
When you invoke the Intel C++ Compiler with icc or icpc, use the following syntax:
{icc|icpc} [options] file1 [file2 . . .]
Argument |
Description |
---|---|
options |
Indicates one or more command-line options. The compiler recognizes one or more letters preceded by a hyphen (-). This includes linker options. |
file1, file2 . . . |
Indicates one or more files to be processed by the compiler. You can specify more than one file. Use a space as a delimiter for multiple files. |