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

Need help installing fortran compiler

  1. Apr 3, 2010 #1
    Hi!

    I wanted to install a f77 compiler, I am running Win7 but also have WinXP, I installed MinGW 5.1.3 and did everything mentioned in this pdf (https://docs.google.com/viewer?url=http://www.pns.anl.gov/instruments/scd/subscd/Fortran_and_C.pdf)

    So, basically its an automatic installer, I just had to add the Enivormental Variables bit

    I went into Advanced settings, created new User variable called PATH and set variable value to C:\MinGW\bin as it says... but when I compiled ( g77 hello.f -o hello ) simple helloworld prg it gave me this:


    C:\>cd MinGW

    C:\MinGW>g77 hello.f -o hello
    hello.f:1:
    PROGRAM MAIN
    ^
    Invalid first character at (^) [info -f g77 M LEX]
    hello.f:2:
    PRINT *, 'HELLO WORLD'
    ^
    Invalid first character at (^) [info -f g77 M LEX]
    hello.f:3:
    STOP
    ^
    Invalid first character at (^) [info -f g77 M LEX]
    hello.f:4:
    END
    ^
    Invalid first character at (^) [info -f g77 M LEX]

    Any clue what might have gone wrong?

    Pls do help...
     
  2. jcsd
  3. Apr 3, 2010 #2

    Mark44

    Staff: Mentor

    Back in the days when FORTRAN programs were punched onto Hollerith cards (AKA IBM cards, there were some rules about what could go where on the card.

    If I'm remembering correctly, the only thing that could go in column 1 was the character C, for comment. Columns 2 through 6 were for line numbers that were used as format statements for READ and WRITE statements.

    Columns 7 through 72 were for program code. The documentation that comes with your compiler (or is available on-line) should tell you if there limitations about which columns program code can go it. That's what I think you're running up against.

    If that's the problem, see if indenting all your code 1 space makes a difference. If that doesn't help, indent your program code so that it starts on column 7 or higher.
     
  4. Apr 3, 2010 #3

    Vanadium 50

    User Avatar
    Staff Emeritus
    Science Advisor
    Education Advisor

    Close, so close.

    Column 1 can only contain a C, indicating that the line is a comment.
    Column 2-5 can contain line numbers for format statements, or for some of the wonderful and wacky FORTRAN features like the computed GOTO.
    Column 6 can only be used to indicate a continuation of the preceding line.
    Column 7-72 can contain code.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Need help installing fortran compiler
  1. Fortran Compiler (Replies: 0)

  2. Fortran compiling Help (Replies: 4)

Loading...