The command to invoke the compiler is ifort.
For Windows and Mac OS* X systems, you can also use the compiler from within the integrated development environment.
On Linux* and Mac OS* X operating systems, you need to set some environment variables to specify locations for the various components prior to using the command line. The Intel Fortran Compiler installation includes a shell script that you can run in your terminal window to set environment variables. For more information, see Using the compilervars File to Specify Location of Components.
On Windows* operating systems, you typically do not need to set any environment variables prior to using the command line. Each of the Intel® Fortran Compiler variations has its own Intel Compiler command-line window, available from the Intel Fortran program folder. This window has the appropriate environment variables already set for the command-line environment.
Use the ifort command either on a command line or in a makefile to invoke the Intel Fortran compiler. The syntax is:
ifort [options]input_file(s)
For a complete listing of compiler options, see the Compiler Options reference.
You can either compile and link your projects in one step with the ifort command, or compile them with ifort and then link them as a separate step.
In most cases, you will use a single ifort command to invoke the compiler and linker.
The ifort command invokes a driver program that is the actual user interface to the compiler and linker. It accepts a list of command options and file names and directs processing for each file.
The driver program does the following:
Calls the Intel® Fortran Compiler to process Fortran files.
Passes the linker options to the linker.
Passes object files created by the compiler to the linker.
Passes libraries to the linker.
Calls the linker or librarian to create the executable or library file.
You can also use ld (Linux OS and Mac OS X) or link (Windows OS) to build libraries of object modules. These commands provide syntax instructions at the command line if you request it with the /? or /help option.
Theifort command automatically references the appropriate Intel Fortran Run-Time Libraries when it invokes the linker. Therefore, to link one or more object files created by the Intel Fortran compiler, you should use the ifort command instead of the link command.
Because the driver calls other software components, error messages may be returned by these other components. For instance, the linker may return a message if it cannot resolve a global reference. The -watch (Linux OS and Mac OS X) or /watch (Windows OS) command-line option can help clarify which component is generating the error.
Windows systems support characters in Unicode* (multibyte) format; the compiler will process file names containing Unicode* characters.
The following rules apply when specifying ifort on the command line:
An option is specified by one or more letters preceded by a hyphen (-) for Linux and Mac OS* X operating systems and a slash (/) for the Windows* operating system. (You can use a hyphen (-) instead of a slash for Windows OS, but this is not the preferred method.)
You can specify more than one input_file, using a space as a delimiter. See Understanding File Extensions.
Some options take arguments in the form of filenames, strings, letters, or numbers. Except where otherwise noted, you can enter a space between the option and its argument(s) or you can combine them. For a complete listing of compiler options, see the Compiler Options reference.
You can specify more than one input_file , using a space as a delimiter. When a file is not in your path or working directory, specify the directory path before the file name. The filename extension specifies the type of file.
Options on the command line apply to all files. For example, in the following command line, the -c and -nowarn options apply to both files x.f and y.f:
ifort -c x.f -nowarn y.f
You cannot combine options with a single slash or hyphen, but must specify the slash or hyphen for each option specified. For example, this is correct: /1 /c
But this is not: /1c
Some compiler options are case-sensitive. For example, c and C are two different options.
Options can take arguments in the form of filenames, strings, letters, and numbers. If a string includes spaces, it must be enclosed in quotation marks.
All compiler options must precede the -Xlinker (Linux OS and Mac OS X) or /link (Windows OS) options. Options that appear following -Xlinker or /link are passed directly to the linker.
Unless you specify certain options, the command line will both compile and link the files you specify. To compile without linking, specify the -c (Linux OS and Mac OS X) or /c (Windows OS) option.
You can abbreviate some option names, entering as many characters as are needed to uniquely identify the option.
Compiler options remain in effect for the whole compilation unless overridden by a compiler directive.
On Windows OS, certain options accept one or more keyword arguments following the option name. To specify multiple keywords, you typically specify the option multiple times. However, some options allow you to use comma-separated keywords. For example:
For options that use a colon, you can use an equals sign (=) instead of the colon.
The following command compiles x.for, links, and creates an executable file. This command generates a temporary object file, which is deleted after linking:
ifort x.for
The following command compiles x.for and generates the object file x.o (Linux OS and Mac OS X) or x.obj (Windows OS). The c option prevents linking (it does not link the object file into an executable file):
ifort -c x.for (Linux OS and Mac OS X) ifort x.for /c (Windows OS)
The following command links x.o or x.obj into an executable file. This command automatically links with the default Intel Fortran libraries:
ifort x.o (Linux OS and Mac OS X) ifort x.obj (Windows OS)
The following command compiles a.for, b.for, and c.for. It creates three temporary object files, then links the object files into an executable file named a.out (on Linux OS and Mac OS X) or a.exe (Windows OS):
ifort a.for b.for c.for
When you use modules and compile multiple files, compile the source files that define modules before the files that reference the modules (in USE statements).
When you use a single ifort command, the order in which files are placed on the command line is significant. For example, if the free-form source file moddef.f90 defines the modules referenced by the file projmain.f90, use the following command:
ifort moddef.f90 projmain.f90
To specify a particular name for the executable file, specify the -o (Linux* OS and Mac OS* X) or /exe (Windows* OS) option:
ifort x.for -o myprog.out (Linux OS and Mac OS X) ifort x.for /exe:myprog.exe (Windows OS)
To redirect output to a file and then display the program output (Linux* OS and Mac OS X):
myprog > results.lis (Linux OS and Mac OS X) more results.lis
To place standard output into file one.out and standard error into file two.out (Windows* OS):
ifort filenames /options 1>one.out 2>two.out (Windows OS)
Or
ifort filenames /options >one.out 2>two.out
To place standard output and standard error into a single file both.out (Windows OS):
ifort filenames /options 1>both.out 2>&1 (Windows OS)
Or
ifort filenames /options >both.out 2>&1
You can use the command-line window to invoke the Intel Fortran Compiler in a number of ways, detailed below.
Use makefiles to specify a number of files with various paths and to save this information for multiple compilations. For more information on using makefiles, see Using Makefiles to Compile Your Application.
Use devenv to set various options for the integrated development environment (IDE) as well as build, clean, and debug projects from the command line. For more information on the devenv command, see the devenv description in the Microsoft Visual Studio* documentation.
Copyright © 1996-2011, Intel Corporation. All rights reserved.