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
or
<install-dir>/bin/iccvars.csh
To "source" an environment script, enter one of the following on the command line:
source <install-dir>/bin/iccvars.sh
or
source <install-dir>/bin/iccvars.csh
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 |
If you compile a program without sourcing iccvars.sh, you will see the following error when you execute the compiled program:
./a.out: error while loading shared libraries: libimf.so: cannot open shared object file: No such file or directory |
Note
With some Linux distributions, if you 'source' iccvars.sh from your .bash_profile, the location of LD_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 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. |