Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Create a New Project

The following steps show how to invoke the compiler from within Microsoft Visual Studio*. Exact steps may vary depending on the version of Microsoft Visual Studio in use.

Step 1: Build a Binary

  1. Launch Microsoft Visual Studio.
  2. Select File > New > Project.
  3. In the New Project window, select a project type under Fortran.

    NOTE:
    Set Fortran as the language in the Language drop down.

  4. Select a template and click OK.
  5. Select Build > Build Solution

The results of the compilation display in the Output window.

Step 2: Set Build Configurations

  1. Right click on Project in Solution Explorer > Properties
  2. Locate Fortran in the list and expand the heading.
  3. Walk through the available properties to select your configuration.

The project and its files appear in the Solution Explorer view. For a COM Server project, you will see a second page with additional user options.

Add an Existing File to the Project

  1. If not already open, open the project (use the File menu).
  2. Select Project > Add > Existing Item.
  3. In the Add Existing Item dialog box that appears, select the Fortran files to be added to the project.

Add a New File to the Project

  1. If not already open, open the project (use the File menu).
  2. Select Project > Add > New Item.
  3. In the Add New Item dialog box that appears, choose the type of file.
  4. Specify the file name. Click Open. The file name appears in the Solution Explorer view.
  5. Use the Microsoft Visual Studio editor to type in source code. Be sure to save your work when you are finished.

Organize Existing Source Code

If you have existing source code, you should organize it into directories before creating a project, although it is easy to move files and edit your project definitions if you should later decide to reorganize your files.

Work with Fortran Modules

If your program uses Fortran modules, you do not need to explicitly add them to your project; they appear as dependencies (.MOD files).

A module file is a precompiled, binary version of a module definition, stored as a .mod file. When you change the source definition of a module, you can update the .mod file before you rebuild your project. To do this, compile the corresponding source file separately by selecting the file in the Solution Explorer window and selecting Build > Compile. If the module source file is part of your project, you do not need to compile the file separately. When you build your project, the Intel® Fortran Compiler determines what files need to be compiled.

To control the placement of module files in directories, use Project > Properties > Fortran > Output Files > Module Path in the IDE or the compiler option module:path on the command line. The location you specify is automatically searched for .mod files.

To control the search for module files in directories, select one of the following:

  • In the IDE:
    • Project > Properties > Fortran > Preprocessor > Default Include and Use Path
    • Project > Properties > Fortran > Preprocessor > Ignore Standard Include Path
  • On the Command Line:
    • X and assume:[no]source_include compiler options.

For a newly created project (or any other project), the IDE scans the file list for sources that define modules and compiles them before compiling the program units that use them. The IDE automatically scans the added project files for modules specified in USE statements, as well as any INCLUDE statements. It scans the source files for all tools used in building the project.

See Also