Using the ifortvars File to Specify Location of Components

Before you first invoke the compiler, you need to be sure certain environment variables are set. These environment variables define the location of the various compiler-related components.

The Intel Fortran Compiler installation includes a file that you can run to set environment variables.

The following information is operating system-dependent.

Linux OS and Mac OS X:

Set the environment variables before using the compiler. You can use the source command to execute the shell script, ifortvars.sh or ifortvars.csh, from the command line to set them.

The script takes an architecture argument:

For example, to execute this script file for the bash shell:

source /opt/intel/Compiler/version_number/package_id/bin/ifortvars.sh ia32

If you use the C shell, use the .csh version of this script file:

source /opt/intel/Compiler/version_number/package_id/bin/ifortvars.csh ia32

If you want ifortvars.sh to run automatically when you start Linux OS or Mac OS X, you can edit your .bash_profile file and add the line above to the end of your file. For example:

# set up environment for Intel compiler source /opt/intel/fc/version_number/package_id/bin/ifortvars.sh ia32

If you compile a program without ensuring the proper environment variables are set, you will see an error similar to the following 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

Windows OS:

Under normal circumstances, you do not need to run the ifortvars.bat batch file. The Fortran command-line window sets these variables for you automatically.

To activate this command-line window, select Fortran Build Environment for applications... available from the Start>All Programs>Intel(R) Software Development Tools>Intel(R) Visual Fortran Compiler Professional

Note iconNote

You will need to run the batch file if you open a command-line window without using the provided Build Environment for applications... menu item in the Intel Fortran program folder or if you want to use the compiler from a script of your own.

The batch file inserts the directories used by Intel Fortran at the beginning of the existing paths. Because these directories appear first, they are searched before any directories in the path lists provided by Windows OS. This is especially important if the existing path includes directories with files having the same names as those needed by Intel Fortran.

If needed, you can run ifortvars.bateach time you begin a session on Windows* systems by specifying it as the initialization file with the PIF Editor.

The batch file takes two arguments:

<install-dir>\bin\ifortvars.bat <arg1> [<arg2>]

<arg1> is one of the following

<arg2>, if specified, is one of the following:

If <arg2> is not specified, the script uses the version of Visual Studio that was detected during the installation procedure.