Affiliate disclosure
Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.
Further Reading: Setting Up
A short guide to going deeper on the toolchain. Sources are tagged Tier 1 (works we are confident exist and recommend) and Tier 2 (real and worth seeking, but confirm the current version or URL yourself, as install instructions and package names drift). This chapter is about tools, so most of the reading is reference documentation you will return to — not to read cover to cover, but to search when you need a flag or a fix.
The compiler itself
- The GNU Fortran (
gfortran) manual — "Invoking GNU Fortran." The authoritative list of every flag gfortran accepts, grouped by purpose (dialect, warnings, debugging, code generation, optimization). When you wonder exactly what-fcheck=allchecks or what-std=f2018forbids, this is the primary source. Tier 1. - The GCC documentation, "Options to Request or Suppress Warnings." The precise contents of
-Wall,-Wextra, and the individual-W…flags — worth a skim so you know what the compiler is and is not telling you. Tier 1.
Getting started, from the community
fortran-lang.org— the "Learn" and "Get Started" pages. The modern, actively maintained introduction to installing a compiler and compiling your first program on each platform; the friendliest companion to this chapter. Tier 1.- The Fortran Discourse (
fortran-lang.discourse.group). Where installation problems — especially the fiddly Windows and macOS ones — are diagnosed generously and quickly. Search before you ask; your problem has usually been solved already. Tier 1.
Platform-specific setup
- The MSYS2 documentation (
msys2.org). The current, canonical instructions for a native GNU toolchain on Windows, including which environment (UCRT64) and package to install. Prefer it over blog posts, which age badly. Tier 2. - Microsoft's WSL documentation. How to install the Windows Subsystem for Linux and a distribution; the recommended path for a Windows user who wants the Linux environment this book (and HPC) ultimately targets. Tier 2.
- The Homebrew documentation (
brew.sh). For macOS users: how to install Homebrew and then thegccformula that carriesgfortran. Tier 2.
The canonical books, on setup and first programs
- Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). Its opening chapters walk through the edit–compile–run process and the anatomy of a first program in the same spirit as this chapter; a good second explanation if any idea here has not yet clicked. Tier 1.
- Milan Curcic, Modern Fortran (Manning). Chapter 1 gets you compiling modern Fortran quickly and with
the right habits (
implicit none, free-form, modern flags), and its perspective closely matches ours. Tier 1.
A tool to bookmark
- Compiler Explorer (
godbolt.org). Selectgfortran, paste a program, and watch it compile with no local setup at all — invaluable when you want to try a snippet without touching your project, or to see how a flag changes what the compiler produces. You are not yet reading the assembly it shows, but the compile-and-run loop is instant. Tier 1.
Suggested order
- Follow the
fortran-lang.org"Get Started" page alongside §2.1 to install your compiler, then verify withgfortran --version. - When a flag puzzles you, look it up in the gfortran manual — reading the real description of
-Wallor-fcheck=allcements what §2.4 introduced. - If installation fights you (most often on Windows or macOS), take the exact error to the Fortran Discourse or the relevant platform documentation above.
- Once you are compiling comfortably, open Compiler Explorer and paste this chapter's
hello.f90into it — a zero-setup sandbox you will return to for the rest of the book.