PDA

View Full Version : Fortran



Lingadharini
August 8th, 2012, 06:07 PM
I am trying to do some Fortran programming. Mine is ubuntu 10.04
Suggest what all files I have to install related to Fortran. How to and where to run the Fortran programs?
I am new to Fortran. So I need help badly..
Please help..:(

xadder
August 9th, 2012, 09:47 AM
Not sure what you want, but if you google fortran f90 tutorial you get some good links. Avoid f77 sites. There are some now dealing with f2003, but despite the 2003 label this variant is not 100% supported yet (afaik, I haven't checked for ages, and most codes I see are f90/f95.)

All you need is a compiler. I use gfortran, it is free, available on all machines, and good.

Lingadharini
August 10th, 2012, 08:52 AM
Thanks, but what should I do to run my fortran code? I am really new to fortran, and I have only the book on how to write a Fortran code, I dont know how to compile fortran or what commands or such sort I have to use for that.

bouncingwilf
August 10th, 2012, 11:50 AM
Fortran seems to be reasonably well supported in Linux - check out this link for "how to's"

http://gcc.gnu.org/wiki/GFortran

I've also found the GTK+ fortran works well as does DISLIN if you want GUI programming.


Bouncingwilf

Eezyville
August 30th, 2012, 11:25 PM
I make fortran programs all the time in Ubuntu. You need a compiler first. so google how to download gfortran or get the free version of intel fortran, the non-commercial use version. Now to compile the programs you first have to make them. Use a text editor to make the program and just type in a terminal thats in the same directory as the file gfortran name_of_file.f90 and it will create an a.out file. Now in the terminal type
./a.out and the code will run.

Senplanet
September 18th, 2012, 05:42 PM
Install gfortran:


sudo apt-get install gfortran
create your fortran file (ex. test.f90)
Example:


program test
write(*,*)'Hello Lingadharini'
end program test
Compile and build:


gfortran test.f90 -o test
This will produce executable file 'test'

to run the program:


./test
It should give you result:


Hello Lingadharini
Good Luck ! :)