Approximatrix, LLC

Download! Purchase!

Simply Fortran Tutorial

This quick tutorial will familiarize new users with the basics of using Simply Fortran. We'll start with creating a new project, then adding a single source file, and finally compiling the Fortran file. The steps can also be used as a starting point for more complex projects. You can interact with the program as we walk through this tutorial.

Simply Fortran also includes a thorough help file that covers how to use the integrated development environment and the complete GNU Fortran compiler manual. Both are available by clicking Contents... in the Help menu.

A Quick Overview

In the image above, the top left corner of the Simply Fortran window at startup is shown. Under the text Project Outline is the panel that lists all the files in our project, currently named "Untitled." When Simply Fortran starts, there are no files in the project.

On the right, you can see a tab labeled Start. The visible page at startup is a start screen that provides new project templates and a list recent projects, if any.

If you haven't registered Simply Fortran yet, the Start tab will be named Unregistered.

Creating a New Project

For this example, we'll start with an empty project that generates an executable. Within the Start tab, select Command-line Program located under "New Projects." Using projects is advisable because it allowes users to organize code and maintain project-specific settings.

Once clicked, a file dialog will open requesting a location to save the project file. This file only contains references to your code, and it is not Fortran source code. Choose a sensible location and name, and click the Save button.

Adding a File to the Project

In the Project Outline, right-click on the project's name, currently "tutorial," to open a popup menu. From here, select Add File(s)... regardless of whether you wish to start from scratch or you have an existing source file.

This same procedure can also be achieved using Add File(s)... in the Project menu in the main window.

After selecting Add File(s)... a standard file dialog will open. Take one of the following actions:

  • Navigate to and select an existing file
  • Enter the name of a new file

By default, the file dialog will start in the directory where you've saved your project. It is often easiest to save your source code in this same directory.

Note that Fortran files must end in an expected extension to work with Simply Fortran. Fixed-format Fortran or FORTRAN 77 files should end with the .f or .for extension, and free-format Fortran should end in .f90, .f95, .f03, or .f08.

Click Ok, and the file should now be listed under your project folder.

Opening a File

After adding a file to the project, the file can be double-clicked in the project tree. When double-clicked, a new editor tab will open where the contents can be edited, as seen in the picture.

In this example, we've added a file called example.f90 that didn't exist yet. If you've selected a pre-existing Fortran file, the editor tab will be populated with the file's contents.

Editing a File

Once the file is open, Fortran code can be entered simply by typing. Any Fortran keywords should be highlighted to help make editing simpler. After making any changes, a small notepad will popup next to the file's name in its tab; this icon indicates that the file has changes that haven't been saved yet.

To save the file, either select Save from the File menu or hold Control and press S.

Saving the Project

Before compiling, the project must first be saved. Because we've added a new file to the project, the structure of said project has changed as it now references our single Fortran file, example.f90.

The project can be saved either by selecting Save Project in the Project menu or by holding Control and Shift and pressing S.

Building the Project

After saving the project, the Fortran code can be compiled simply by selecting Build Now! from the Build menu.

Once Build Now! is clicked, a Build Status tab will open. This tab will present the output of the compiler as the build progresses. If there are any errors during compilation, they will also be presented in this tab. In the example shown, the compilation completes without problems.

Running Your Code

If your code was successfully compiled, you can now run the resultant program by selecting Launch! from the Build menu. A Console tab will open, and the program's output will be shown as appropriate.

More Information

This quick tutorial has outlined the steps necessary to get started in Simply Fortran. Similar to the steps described, you can add multiple files to your project, work with large, existing codebases, or start from a different example provided on the Start tab.

More information is available either in the included documentation. If you are experiencing difficulties, have questions, or wish to suggest improvements, visit the Approximatrix Forums or email Approximatrix support at support@approximatrix.com.