Forrest logo
back to the gfortran tool

gfortran:tldr:ee4a5

gfortran: Compile source code into an object file without linking.
$ gfortran -c ${path-to-source-f90}
try on your machine

The command "gfortran -c ${path-to-source-f90}" is a command-line instruction using the gfortran compiler to compile a Fortran source file (.f90) into an object file (.o).

Here's a breakdown of the command:

  • "gfortran": This is the compiler command used to invoke the GNU Fortran compiler. It is responsible for compiling and linking your Fortran code.

  • "-c": This flag specifies that the compiler should only perform compilation and produce an object file (.o). It tells the compiler not to perform any linking with other object files, libraries, or executables.

  • "${path-to-source-f90}": This is a placeholder representing the path to your Fortran source file (.f90) that you want to compile. You should replace "${path-to-source-f90}" with the actual file path. For example, if your source file is located in "/home/user/code/myprogram.f90", you would replace "${path-to-source-f90}" with "/home/user/code/myprogram.f90".

Putting it all together, the command "gfortran -c ${path-to-source-f90}" instructs the gfortran compiler to only compile (not link) the Fortran source file specified by "${path-to-source-f90}" and produce an object file as output.

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