Need help installing fortran compiler

  • Context: Fortran 
  • Thread starter Thread starter logix88
  • Start date Start date
  • Tags Tags
    Compiler Fortran
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 6K views
logix88
Messages
12
Reaction score
0
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...
 
on Phys.org
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.
 
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.