Back to index.html.
Setup of a programming environment
Procedure in programming
Programming in a compiled language has a typical workflow: write a program, compile the program, and run or execute the program.
First of all, you have to write a program in programming language and save it to a file. This original file is called source file, and the program you write is called source code. The source file is human-readable, and it is translated (converted) to a machine-readable executable file. The executable is the actual body of the program (an application program, as widely known as app). Almost all apps are developed with this process.
You have to use tools to help this process.
- Text editor: A tool to edit a source file. You have to write a program and save it as a text file. A text editor has many useful features in programming.
- Compiler: A tool to compile (convert) the source file. It also checks the correctness of the program before the compilation.
If the program has apparent mistakes or errors, the program does not compile. Even if the program is correct, it may have logical errors that result in unexpected behavior. Such an error is called bug, and debug is a process to detect and remove the issues.
There is a tool named integrated development environment (IDE), in which a user can write, compile, execute, and debug a program seamlessly. Unfortunately, Fortran has minimal choices of IDE (which, I would say, you do not have to have unless your project is complex, fortunately). The following sections introduce you to some free editors and compilers, as well as some IDEs.
Compilers and editors
GFortran is a free Fortran-compiler. You can freely download, install, use, distribute the compiler, and compiled programs. A separate article explains how to install GFortran in Windows 10. I tend to recommend this compiler for learning Fortran. See http://www.gcc.org/gfortran for details.
Intel Fortran Compiler is a commercial product and probably it is the most widely used compiler in heavy numerical computations. You need a license to use this compiler. This compiler generally creates an executable more efficient than GFortran.
PGI Fortran is another proprietary compiler. PGI is now a brand of NVIDIA, a company manufacturing a graphical processing unit (GPU). PGI Fortran supports some extensions to use GPU. They release a free version of the compiler as Community Edition.
You may see g95 as a free Fortran compiler, recommended by several tutorials online. In my opinion, you should not use it because it is old. It does not have new features that this tutorial uses.
There are other compilers. Some of them are working on a specific computing environment (like a supercomputing cluster).
Any operating systems have a text editor; for example, Windows has Notepad, and macOS has Text Editor. These editors do not have many features useful to write a program. Plenty of editors are available online, and most of them are free (because an editor is an essential tool for programmers, and they have been developed editors for their use). You have to find your favorite editor by yourself because each editor has different look-and-feeling. Here are some well-known editors.
- Notepad++ (Windows)
- Visual Studio Code (Windows. macOS, Linux)
- Atom (Windows. macOS, Linux)
In a Linux/Unix shell (a command-line terminal), the following editors are available (vim is available in almost any environment, but the others are optional).
- vi (or vim)
- gedit (only the window environment)
Some companies provide online development tools for free. The solution is useful to learn the language and execute a small program.
Coding ground is one of such services. See https://www.tutorialspoint.com/codingground.htm and choose Fortran95 in the list. You can edit a program, compile it, and run it in your browser. You may download your programs into local files after you sign up for the service.
IDE for Fortran
An integrated development environment (IDE) unifies all required tools and gives you a consistent interface. Code::Blocks IDE for Fortran is a new IDE distributed under a free-software license. FTN95 is a proprietary IDE for free use. If you would like to use specialized tools, please look for your favorite one. But again, you would not need IDE unless your workflow requires it.
Back to index.html.