Get Started on Windows*
Before You Begin
You must have a version of Microsoft Visual Studio* installed to use the compiler.
The compiler integrates into the following versions of Microsoft Visual Studio:
- Microsoft Visual Studio 2019
- Microsoft Visual Studio 2017
For full functionality within Microsoft Visual Studio, including debugging and development, Microsoft Visual Studio Community Edition or higher is required. Microsoft Visual Studio Express Edition allows only command-line builds. For all versions, Microsoft Desktop Development with C++ support must be selected as part of the Visual Studio install.
You typically do not need to set the environment variables on Windows, as the compiler command-line window sets these variables for you automatically. If you need to set the environment variables, run the environment script as described in the suite-specific Get Started documentation.
<install_dir> is the installation directory. By default, it is \Intel\oneAPI\compiler\<version>.
Option 1: Use the Command Line
Follow the steps below to invoke the compiler.
Step 1: Open a command prompt
On Windows 10- Open the Start menu
- Select Compiler Command Prompt under Intel oneAPI 2021
- Open the Start menu
- Select Command prompt with Intel Compiler under Intel oneAPI > Compiler and Performance Libraries
- Select a build environment
Step 2: Invoke the compiler
Use the command below to invoke the compiler from the command line:
- ifort [options... ] inputfile(s) [/link link_options]
- ifx [options... ] inputfile(s) [/link link_options]
Use the command below to display all available compiler options:
- ifort /help
- ifx /help
Option 2: Use Microsoft Visual Studio
Follow the steps below to invoke the compiler from within Microsoft Visual Studio.
Step 1: Build a binary
Launch Microsoft Visual Studio.
Select File > New > Project.
In the New Project window, select a project type under Intel® Visual Fortran.
Select a template and click OK.
Select Build > Build Solution.
The results of the compilation display in the Output window.
Step 2: Set build configurations
- Right click on Project in Solution Explorer > Properties
- Locate Fortran in the list and expand the heading
- Walk through the available properties to select your configuration
Switch to the Intel® Fortran Compiler from the Microsoft Visual Studio Fortran Compiler
- Launch Microsoft Visual Studio and open a solution or project
- Select Project > Intel Compiler > Use Intel Fortran
- Select OK
- Select Build > Rebuild Solution
Switch to the Microsoft Visual Studio Fortran Compiler from the Intel® Fortran Compiler
This action updates the solution file to use the Microsoft Visual Studio Fortran compiler. All configurations of affected projects are automatically cleaned unless you select Do not clean project(s). If you choose not to clean projects, you will need to rebuild updated projects to ensure all source files are compiled with the new compiler.
- Launch Microsoft Visual Studio and open a solution or project
- Select Project > Intel Compiler > Use Intel Visual Fortran
Build a Program From the Command Line
Follow the steps below to test your compiler installation and build a program.
- Use a text editor to create a file called "hello.f90" with the following contents:
print *, “hello!” end
- From a command window, issue the following command:
C:\users\me> ifort hello.f90
C:\users\me> ifx hello.f90
- Now you have an executable called "hello", which can be run and will give immediate feedback.
C:\users\me> hello hello!
Fortran supports parallel processing by replicating images and allowing inter-image communication. This is done using coarrays, described in Intel® Fortran Compiler Tutorial: Using Coarray Fortran. Even though the "hello" program used above does not contain any coarray data, it can still be run as a coarray program.
C:\users\me> ifort /Qcoarray /Qcoarray-num-images:4 hello.f90 C:\users\me> hello hello! hello! hello! hello!
C:\users\me> ifx /Qcoarray /Qcoarray-num-images:4 hello.f90 C:\users\me> hello hello! hello! hello! hello!
Next Steps
- Explore the latest oneAPI Fortran Code Samples and Intel® Fortran Compiler Tutorials .
- Explore the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference on the Intel® Developer Zone.