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

Fortran Teaching myself gfortran

  1. Mar 31, 2017 #1

    MathematicalPhysicist

    User Avatar
    Gold Member

    So I have a Ubuntu machine with gfortran installed in it.

    I wrote the following simple code in fortran:
    Code (Fortran):

    program calculation
       print *, 55+55
    end program calculation
     
    I saved it as 'calculation.f' file and then tried to compile it in the terminal, but got the following errors:
    Code (Text):

    calculation.f:1:1:

     program calculation
     1
    Error: Non-numeric character in statement label at (1)
    calculation.f:1:1:

     program calculation
     1
    Error: Unclassifiable statement at (1)
    calculation.f:3:1:

     end program calculation
     1
    Error: Non-numeric character in statement label at (1)
    calculation.f:3:1:

     end program calculation
     1
    Error: Unclassifiable statement at (1)
    f951: Error: Unexpected end of file in ‘calculation.f’


     
    Where did I go wrong here?

    Thanks.
     
  2. jcsd
  3. Mar 31, 2017 #2

    DrClaude

    User Avatar

    Staff: Mentor

    You didn't paste the error you got, but I suspect what it is. Since you are using free form, not the fixed column format (left over from the punch card era), the filename should end in .f90 instead of .f.
     
  4. Mar 31, 2017 #3

    MathematicalPhysicist

    User Avatar
    Gold Member

    Works fine now.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Teaching myself gfortran
  1. Teaching myself C++? (Replies: 10)

Loading...