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

    Join Date
    May 2010
    Posts
    9
    Rep Power
    0

    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
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Sounds like you don't have the whole compiler installed. Here's what I did using Ubuntu:
    Code:
    sudo apt-get install gfortran
    Then I typed out hello.f
    Code:
          PROGRAM hello
          PRINT *, "Hello World!"
          END PROGRAM hello
    and compiled and ran it:
    Code:
    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
    Code:
          WRITE (*,*) "Hello World"
          END
    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 Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,894
    Rep Power
    481

    f90


    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