Skip to content

Compilation: basic case in Fortran

We must choose a name for the file and a name for the main program unit. Advice: use the same name for the main program unit and the file.

Advice for name of file

Read the beginning of the course on compilation. Use the suffix .f if you are going to use make. Read the beginning of the course on make.

How to run the program

  • Once you have compiled the program, you can run it. Just type the name of the executable file on the command line (in a terminal), including the path to that executable file. For example: my_test_directory/my_program (relative path) or: /home/guez/Documents/my_test_directory/my_program (absolute path).

  • Note that the current directory when you run your program does not have to be the directory where the executable file is.

  • Remember (from the Unix class) that the dot . means ”current directory”. So if your executable file is in the current directory when you run the program, you can just type: ./my_program, it is a particular case of relative path.