# Fortran

CLion supports [Fortran](http://fortranwiki.org/fortran/show/Standards) via the [Fortran plugin](https://github.com/satamas/fortran-plugin/). The plugin provides language support and debugger for FORTRAN 77/90/95/2003/2008. Application support is provided by [CMake](quick-cmake-tutorial.html).

> **Tip:**
> The Fortran plugin is currently under development. You can share your feedback or submit a request in the projects's GitHub [tracker](https://github.com/satamas/fortran-plugin/issues).

> **Tip:**
> Find a sample Fortran project build with CMake in [this wiki](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/languages/fortran/ForFortranExample).

Procedure: Start a Fortran project in CLion

1. Install the Fortran compiler.

You can use GNU Fortran compiler included in the GCC installation or another Fortran compilers of your choice.

2. Install the Fortran plugin. Use one of the options:

* In CLion, go to `Settings | Plugins`, switch to Marketplace and type Fortran in the search field, then click Install in the plugin description dialog.

* Alternatively, install the plugin directly from [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/9699-fortran/).

3. Create a new Fortran executable project (`File | New Project`) or [open](opening-reopening-and-closing-projects.html#open-project) an existing CMake-based Fortran project.

> **Note:**
> To instruct CMake on where to find the Fortran compiler, set the `FC` or `CMAKE_Fortran_COMPILER` environment variable in your [CMakeLists.txt](cmakelists-txt-file.html) (provide the full path to the compiler executable or only the compiler name in case the `PATH` variable is set accordingly). For more information, refer to [CMake documentation](https://cmake.org/cmake/help/latest/envvar/FC.html).

## Working with Fortran code

In addition to parsing and highlighting your Fortran code, the plugin provides other code insight features, such as

* Code editing: Add Line Comment `Ctrl+/` (Windows), `⌘ /` (macOS), `⌘ /` (IntelliJ IDEA Classic (macOS)), `⌘ /` (macOS System Shortcuts), `Ctrl+/` (XWin), `Ctrl+/` (GNOME), `Ctrl+/` (KDE), `Alt+;` (Emacs), `Ctrl+/` (Sublime Text), `⌘ /` (Sublime Text (macOS)), `⌘ /` (Xcode), `Ctrl+Alt+/` (Visual Studio), `⌘ ⌥ /` (Visual Studio (macOS)), `Ctrl+/` (ReSharper), `⌘ /` (ReSharper (macOS)), `Ctrl+/` (QtCreator), `⌘ /` (QtCreator (macOS)), `Ctrl+/` (NetBeans), `Ctrl+/` (Eclipse), `⌘ /` (Eclipse (macOS)), Code folding, Brace matching, and Formatting (currently available only for free source form files) ![Code styles for Fortran](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_fortran_format.png)

* Navigation actions: Go to Definition, Structure view, and Find Usages ![Find Usages for Fortran](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_fortran_usages.png)

* Code analysis: a set of useful code inspections to catch potential errors ![Code inspections for Fortran](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_fortran_inspections.png)

## Running and debugging

Procedure:

1. To run and debug Fortran code, create a [CMake Application](run-debug-configuration-application.html) configuration (go to `Run | Edit Configurations` in the main menu, press ![plus](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) and select CMake Application).

![CMake run/debug configuration for Fortran](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_fortran_cmakeapp.png)

2. In the toolchain settings (`Settings | Build, Execution, Deployment | Toolchain`), [switch](configuring-debugger-options.html#select-debugger) to GDB in the Debugger field.

3. Run![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.execute.svg) or Debug![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.startDebugger.svg) the newly created configuration:

![Debugging Fortran](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_fortran_debug.png)

## See also

### Reference

[CMake Settings](cmake0.html) [CMake Tool Window](cmake.html)

### Procedures

[Quick CMake tutorial](quick-cmake-tutorial.html)

### External Links

[CMake documentation](http://www.cmake.org/documentation/)

