1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Rep Power

    Compliling in Fortran

    I'm having some trouble compiling with g95. I have a simple Hello World Program, shown below.

    program hello
    print *, "Hello World!"
    end program hello
    (There are six spaces in front of the top and bottom lines, and nine in front of the middle line.)
    It was taken exactly from the wikibooks Fortran instruction guide. However, when I try to compile it, the assembler gives me an error:

    /tmp/cc6yBTSc.s: Assembler messages:
    /tmp/cc6yBTSc.s:11: Error: invalid instruction suffix for `push'
    I am using g95 for Linux x86. My operating system is Linux Mint.

    Does anyone know how I can fix this and get the program to compile? Thanks!
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    Sounds like you don't have the whole compiler installed. Here's what I did using Ubuntu:
    sudo apt-get install gfortran
    Then I typed out hello.f
          PROGRAM hello
          PRINT *, "Hello World!"
          END PROGRAM hello
    and compiled and ran it:
    mb@motorhead:~/fortran$ f95 hello.f -o hello
    mb@motorhead:~/fortran$ ./hello 
     Hello World!
    Maybe I should read up more on Fortran 95. I'm more familiar with F77 style code. For one thing, I would have written it as
          WRITE (*,*) "Hello World"
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power


    Originally Posted by Scorpions4ever
    Maybe I should read up more on Fortran 95. I'm more familiar with F77 style code. ...
    f90 is a whole lot more fun than f77.

IMN logo majestic logo threadwatch logo seochat tools logo