Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question about Fortran 95

  1. Sep 11, 2010 #1
    I am a student who is currently enrolled in a computer science class, and the program we are using is Fortran 95. I was wondering how I could get this program/compiler onto my own computer? I have almost no experience with programming and Fortran so I really want toget this on my own system rather than only being able to use it at school.

    Basically every version of it I have used is run off of a Linux system, and you just select an icon on the desktop called "Terminal" and then use a program editor called "gedit" to write the programs. I don't know if this is how all Fortran compilers work or anything, but I am pretty sure If I got my own version it would have to work just like the ones on my school computer.

    Basically, I have Window's 7 pro on my laptop. Can I get the same compiler/program for my OS that runs on the Linux system? Someone told me that you could get Linux to run on your Windows 7 OS but I don't know how to do that or how expensive any of this costs.

    Any advice would be great.
  2. jcsd
  3. Sep 11, 2010 #2
    If all you want is a Linux-like environment for Fortran programming, it's best to install Cygwin. Installing Cygwin may be a bit of a headache (find guides online), but installing Linux will burn you if you're not experienced.

    Cygwin gives you an Fortran programming environment nearly identical to what you'll find on the school Linux system. In the installation menu, make sure to set the group "devel" to "install". Then the gfortran compiler will be installed. An icon "Cygwin" will appear on your desktop. That's the equivalent of your "terminal". When you type "gedit", replace it with "Notepad". (Later you may want to try some other text-editors such as Notepad++ for Windows.)

    Again, you need to find installation guides online. Basically apart from running setup.exe, you need to set environment variables, and you may need to run "rebase" after the install.
  4. Sep 11, 2010 #3
    Alright I installed Cygwin and got the Notepad up and all. Are the other commands different? Like how to I open a notepad document in the compiler and compile it and all?
  5. Sep 11, 2010 #4
    I have no idea whether cygwin comes with gcc or not but check it out.

    You use any editor (like notepad) to make the source code files and the compiler to compile it to machine code.
  6. Sep 11, 2010 #5
    1. Open Cygwin, launch Notepad
    Code (Text):

    notepad hello.f90 &
    2. Write a program, click file->save. Do not close Notepad, so you can continue editing later.
    3. Compile
    Code (Text):

    gfortran hello.f90 -o hello
    If there's any error, edit the program until it compiles correctly.
    4. Run it.
    Code (Text):

    Hopefully you can see the output of your program.

    @Santa1: Cygwin comes with the full GCC suite.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook