How to Run a Hello World script using GFortran What is GFortran? GNU Fortran is a part of GCC, the GNU Compiler Collection. GCC consists of a collection of front ends for various languages, which translate the source code into a language-independent form called GENERIC. This is then processed by a common middle end which provides optimization, and then passed to one of a collection of back ends which generate code for different computer architectures and operating systems. Additional information regarding what GFortran is can be found here. This short tutorial is a guide to help familiarize you with writing a simple Hello World program using the GFortran compiler using Ubuntu. Follow the Ubuntu tutorial. 1) With Ubuntu running on your virtual machine, open the Terminal window.2) Check to see if you have gfortran installed.
3) Install gFortran
3) The gfortran package will then begin the brief installation process and will require you to enter yes or no to continue.5) Once complete, the command ‘which gfortran’ will successfully return a message on the following line showing the directory where gfortran can be found.6) To successfully run our first “helloworld” script using gfortran, let’s start by creating a file using the unix text editor pico.
![]() 7) Let’s create our first program by entering the command “pico fortran.f”
![]() ![]() 8) To create a simple helloword script simply enter the code:
![]() 8) After exiting you will find yourself back at the terminal window.9) Let’s try running the script you just created by first compiling the file.
11) Congratulations! You ran your first gfortran script |
Engineering Software > Programming basics >