Before you invoke the compiler, you may need to set certain environment variables that define the location of compiler-related components. The Intel® Fortran Compiler Classic and Intel® Fortran Compiler includes environment configuration scripts to configure your build and development environment variables:
The following information is operating system dependent.
Set the environment variables before using the compiler by sourcing the shell script setvars.sh. Depending on the shell, you can use the source command or a . (dot) to source the shell script, according to the following rule for a .sh script:
source /<install-dir>/setvars.sh <arg1> <arg2> … <argn> . /<install-dir>/setvars.sh <arg1> <arg2> … <argn> # examples: (assuming <install-dir> is /opt/intel/oneapi) prompt> source /opt/intel/oneapi/setvars.sh intel64 prompt> . /opt/intel/oneapi/setvars.sh intel64
The compiler environment script file accepts an optional target architecture argument <arg>:
If you want the setvars.sh script to run automatically in all of your terminal sessions, add the source setvars.sh command to your startup file. For example, inside your .bash_profile entry for Intel® 64 architecture targets:
# set environment vars for Intel® Fortran Compiler source <install-dir>/setvars.sh intel64
If the proper environment variables are not set, errors similar to the following may appear when attempting to execute a compiled program:
./a.out: error while loading shared libraries: libimf.so: cannot open shared object file: No such file or directory
Under normal circumstances, you do not need to run the setvars.bat batch file. The terminal shortcuts in the Windows Start menu, Intel oneAPI command prompt for <target architecture> for Visual Studio <year>, set these variables automatically.
For additional information, see Using the Command Line on Windows.
The setvars batch file inserts DLL directories used by the compiler and libraries at the beginning of the existing Path. Because these directories appear first, they are searched before any directories that were part of the original Path provided by Windows (and other applications). This is especially important if the original Path includes directories with files that have the same names as those added by the compiler and libraries.
The setvars batch file takes multiple optional arguments; the following two arguments are recognized for compiler and library initialization:
<install-dir>\setvars.bat [<arg1>] [<arg2>]
Where <arg1> is optional and can be one of the following:
The <arg2> is optional. If specified, it is one of the following: