- IDEs#
- Среда разработки fortran linux
- Vim
- XWindow Programming Environment
- Installing GFortran#
- Windows#
- Unix-like development on Windows#
- Linux#
- Debian-based (Debian, Ubuntu, Mint, etc…)#
- RPM-based (Red Hat Enterprise Linux, CentOS, Fedora, openSUSE)#
- Arch-based (Arch Linux, EndeavourOS, Manjaro, etc…)#
- macOS#
- Xcode#
- Binaries#
- Homebrew#
- Fink#
- MacPorts#
- OpenBSD#
- OpenCoarrays#
IDEs#
An IDE (Integrated Development Environment) refers to a complete software development environment, where, all those packages that come as external plug-ins in Text-Editors, are already integrated within the software. An IDE is usually optimized towards a specific set of languages. For example it is very common for IDEs to advertise themselves towards either compiled or interpreted languages, or even towards a single language, or depending on the application developed, like scientific or web development. IDEs are recommended for beginner programmers, since it is possible to start coding with minimum effort after installation. However, it is quite common, in professional environments, individual developers and teams alike, to choose an IDE for large projects because of some unique features that they may offer over a Text-Editor.
A list of popular IDEs that provide good Fortran support is provided in alphabetical order:
- AbsoftTools: commercial product, cross-platform, comes with Absoft’s own Fortran compiler.
- Code::Blocks: free product, cross-platform and supports multiple compilers. Plenty of tutorials online on how to install it and add a Fortran Compiler. As well as a recent presentation, here, of its capabilities and future prospects at the International Fortran Conference 2020 by its main developer.
- Eclipse-PhotranPhotran is an IDE and refactoring tool for Fortran based on Eclipse and the C/C++ Development Tools. A free product, cross-platform and supports multiple compilers.
- Geany: a free product, cross platform and supports multiple compilers.
- NAG Fortran Builder is a commercial product, available in Windows and MacOS and supports NAG’s own Fortran Compiler.
- Plato is a commercial product, cross-platform, comes with Silverfrost’s Fortran FTN95 own Fortran compiler.
- SimplyFortran is a commercial product, cross-platform with support of the GNU Fortran compiler.
- Visual Studio its Community Edition 2019 is a free product, available in Windows and macOS and supports only Intel’s Fortran compiler, now bundled with many other free-to-use HPC tools under Intel oneAPI.
© Copyright 2020-2022, Fortran Community.
Среда разработки fortran linux
An integrated development environment (IDE) is not implicitly required for programming in Fortran. In most cases, a free editor is sufficient, like:
The Fortran Wiki lists several more editors with syntax highlighting support for Fortran.
You may want to use one of the following free IDEs for your more sophisticated projects:
- Code::Blocks IDE for Fortran (Linux, Windows),
- Eclipse Photran (Linux, Unix, macOS, Windows),
- Force Fortran IDE for Fortran 77/90 (Windows),
- NetBeans IDE, using the C/C++/Fortran bundle (Linux, Unix, macOS, Windows),
- Oracle Developer Studio (RHEL, Solaris),
- Microsoft Visual Studio Code (Linux, Unix, macOS, Windows).
- XWindow Programming Environment, Borland-like IDE for X11 (Linux, Unix).
Some commercial IDEs feature Fortran support, like:
Vim
Please see :help fortran for information regarding syntax highlighting of Fortran source code in Vim. You can set some Fortran-specific variables in your .vimrc :
syntax on let fortran_free_source=1 let fortran_have_tabs=1 let fortran_more_precise=1 let fortran_do_enddo=1
XWindow Programming Environment
The XWindow Programming Environment (xwpe) IDE includes a top menu to directly compile and run a Fortran application. Open the Compiler Options window under Options → Compiler → Fortran. On FreeBSD, set, for example:
Option | Value |
---|---|
Compiler | gfortran13 |
Compiler-Options | -I=/usr/local/include/ -L/usr/local/lib/ |
File-Postfix | .f90 |
Compiler-Style | GNU |
Then, open Project → Options and set additional compiler options, the name of the executable, and further arguments. Select Run → Compile in the menu to compile the program.
The font size can be increased, for example, to 18 pixels, by adding the following X resource to ~/.Xdefaults :
Run xfontsel(1) to select a valid font name. An additional syntax definition file for syntax highlighting of Fortran 90 source code is available on the project website.
Installing GFortran#
GFortran is the name of the GNU Fortran project. The main wiki page offers many helpful links about GFortran, as well as Fortran in general. In this guide, the installation process for GFortran on Windows, Linux, macOS and OpenBSD is presented in a beginner-friendly format based on the information from GFortranBinaries.
Windows#
Three sources provide quick and easy way to install GFortran compiler on Windows:
- http://www.equation.com, provides 32 and 64-bit x86 executables for GCC version 12.1.
- TDM GCC, provides 32 and 64-bit x86 executables for GCC version 10.3.
- MinGW-w64 provides a 64-bit x86 executable for GCC version 12.2.
In all the above choices, the process is straightforward—just download the installer and follow the installation wizard.
Unix-like development on Windows#
For those familiar with a unix-like development environment, several emulation options are available on Windows each of which provide packages for gfortran:
- Cygwin: A runtime environment that provides POSIX compatibility to Windows.
- MSYS2: A collection of Unix-like development tools, based on modern Cygwin and MinGW-w64.
- Windows Subsystem for Linux (WSL): An official compatibility layer for running Linux binary executables on Windows. With Windows Subsystem for Linux GUI one can run text editors and other graphical programs.
All of the above approaches provide access to common shells such as bash and development tools including GNU coreutils, Make, CMake, autotools, git, grep, sed, awk, ssh, etc.
We recommend the WSL environment for those looking for a Unix-like development environment on Windows.
Linux#
Debian-based (Debian, Ubuntu, Mint, etc…)#
Check whether you have gfortran already installed
If nothing is returned then gfortran is not installed. To install gfortran type:
sudo apt install gfortran
to check what version was installed type:
You can install multiple versions up to version 10 (on Ubuntu 22.04) by typing the version number immediately after “gfortran”, e.g.:
sudo apt install gfortran-8
To install newer versions on older Ubuntu releases, you will first need to add the following repository, update, and then install:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gfortran-10
Finally, you can switch between different versions or set the default one with the update-alternatives (see manpage). There are many online tutorials on how to use this feature. A well structured one using as an example C and C++ can be found here, you can apply the same logic by replacing either gcc or g++ with gfortran .
RPM-based (Red Hat Enterprise Linux, CentOS, Fedora, openSUSE)#
sudo yum install gcc-gfortran
Since Fedora 22 and Red Hat Enterprise Linux 8, dnf is the default package manager:
sudo dnf install gcc-gfortran
Arch-based (Arch Linux, EndeavourOS, Manjaro, etc…)#
macOS#
Xcode#
If you have Xcode installed, open a terminal window and type:
Binaries#
Go to fxcoudert/gfortran-for-macOS to directly install binaries.
Homebrew#
Fink#
MacPorts#
Search for available gcc versions:
OpenBSD#
On OpenBSD, the GFortran executable is named egfortran . To test it, type:
OpenCoarrays#
OpenCoarrays is an open-source software project that produces an application binary interface (ABI) used by the GNU Compiler Collection (GCC) Fortran front-end to build executable programs that leverage the parallel programming features of Fortran 2018. Since OpenCoarrays is not a separate compiler, we include it here, under gfortran.
While with gfortran you can compile perfectly valid code using coarrays, the generated binaries will only run in a single image (image is a Fortran term for a parallel process), that is, in serial mode. OpenCoarrays allows running code in parallel on shared- and distributed-memory machines, similar to MPI:
The process of installation is provided in a clear and comprehensive manner on the official site.
We emphasize that native installation on Windows is not possible. It is only possible through WSL.
© Copyright 2020-2022, Fortran Community.