Forrest logo
back to the gfortran tool

gfortran:tldr:252c6

gfortran: Show common warnings, debug symbols in output, and optimize without affecting debugging.
$ gfortran ${path-to-source-f90} -Wall -g -Og -o ${path-to-output_executable}
try on your machine

This command is using the GNU Fortran compiler gfortran to compile a Fortran source code file and produce an executable file.

Let's break down the command:

  • ${path-to-source-f90}: This is a placeholder for the path to the Fortran source code file you want to compile. You need to replace this placeholder with the actual file path.

  • -Wall: This is a compiler flag that enables all warning messages. It informs the compiler to display any warning messages related to potential issues in your code.

  • -g: This flag includes debug information in the generated executable file. It allows you to use debugging tools to analyze and debug your program.

  • -Og: This flag enables the optimization level "g". This level provides a good balance between optimization and maintaining debugability. It optimizes the code for debugging experience rather than performance.

  • -o ${path-to-output_executable}: This is another placeholder for the path to the output executable file that will be generated. You need to replace this placeholder with the desired path and file name.

Once you replace the placeholders with actual file paths, you can execute this command in your command-line interface or terminal to compile your Fortran code using gfortran with the specified options and generate an executable file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gfortran tool