CLion 2018.2 Help

Fortran Support

CLion supports Fortran via the plugin compatible with all IntelliJ-based IDEs. This plugin includes smart editor, navigation actions, code analysis and debugger for FORTRAN 77/90/95/2003/2008 source code. Application support is provided via CMake.

Starting a Fortran project in CLion:

  1. Install the Fortran plugin either directly from the Plugin Repository webpage or right from CLion: go to Settings / Preferences | Plugins, click Browse repositories and type Fortran in the search field, then click Install in the plugin description dialog.

  2. Create a new Fortran executable project (File | New Project) or load an existing (File | Import Project) CMake-based Fortran project.

  3. Instruct CMake on where to find the Fortran compiler. You can do so by setting the FC environment variable or the CMake cache entry CMAKE_Fortran_COMPILER (giving the full path to the compiler executable or simply the compiler name in case the PATH variable is set accordingly).

Working with Fortran code

In addition to parsing and highlighting your Fortran code, the plugin provides many smart actions.

  • Code editing: Add Line Comment (Ctrl+/), Code folding, Brace matching, and Formatting (currently available only for free source form files)

    Code styles for Fortran

  • Navigation actions: Go to Definition, Structure view, and Find Usages

    Find Usages for Fortran

  • Code analysis: a set of useful code inspections to catch potential errors

    Code inspections for Fortran

Running and debugging

To run and debug Fortran code, you need to create an Application configuration (Run | Edit Configurations, press plus and click Application), and switch to GDB as a working debugger.
Debugging Fortran
Last modified: 27 November 2018

See Also