How To Compile Your First Fortran90 Program
  1. Log in to the H205 machines (see how to log in From a Mac computer or From a Windows computer
  2. Create a new folder. Let's call it "ps1" for problem set 1. To do this, type "mkdir ps1" (i.e., makedirectory)
  3. Go into that folder. To do this, type "cd ps1" (i.e., changedirectory )
  4. Create the program file. Use your preferred text editor (see How to edit files ) to create a file named "hello_world.f90" Here's what we want to put into the file:
program hello 
  implicit none
    write (*,*) "hello world!" 
    stop
end program hello

5. Compile the program (in other words, we will turn the text above into a program that can be understood by the computer). NOTE: You must first close the editor before you try to compile and run the program!! For example, if running Pico, close Pico and then type the rest to compile in X11 (the initial terminal). Then to compile, type "pgf90 hello_world.f90". This will create a program called "a.out".
6. Run the program, by typing "./a.out"
7. You can also specify what you want the program to be called. To do this, type "pgf90 -o hello_world.r hello_world.f90" Now you can run the program by typing "./hello_world.r"

Congratulations! You have just written, compiled, and run your first Fortran90 program!


Now that this is working, you are ready to learn how to program in Fortran 90 [http://F90in15Minutes.wikidot.com/]

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License