need help with fortran

Started by
4 comments, last by Zahlman 17 years, 7 months ago
Hey, I'm trying to compile a Hello World using gfortran on a Mac. This is the program: test.f

PROGRAM HelloWorld
WRITE(*,*)  "Hello World!"
END PROGRAM
this is what I do:

gfortran test.f
and I get a bunch of errors:

In file Desktop/test.f:1

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410                      
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:1

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410                      
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:2

{\fonttbl\f0\fmodern\fcharset77 Courier;}                               
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:2

{\fonttbl\f0\fmodern\fcharset77 Courier;}                               
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:2

{\fonttbl\f0\fmodern\fcharset77 Courier;}                               
                                       1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:3

{\colortbl;\red255\green255\blue255;}                                   
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:3

{\colortbl;\red255\green255\blue255;}                                   
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:3

{\colortbl;\red255\green255\blue255;}                                   
          1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:3

{\colortbl;\red255\green255\blue255;}                                   
                                   1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:4

\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkin
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:4

\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkin
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:5

\deftab720                                                              
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:5

\deftab720                                                              
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:6

\pard\pardeftab720\ql\qnatural                                          
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:6

\pard\pardeftab720\ql\qnatural                                          
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:8

\f0\fs26 \cf0 PROGRAM HelloWorld\                                       
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:8

\f0\fs26 \cf0 PROGRAM HelloWorld\                                       
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:9

WRITE(*,*)  "Hello World!"\                                             
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:9

WRITE(*,*)  "Hello World!"\                                             
1
Error: Unclassifiable statement at (1)
 In file Desktop/test.f:10

END PROGRAM}
1
Error: Non-numeric character in statement label at (1)
 In file Desktop/test.f:10

END PROGRAM}
1
Error: Unclassifiable statement at (1)
whats wrong? thanks
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Advertisement
Try reducing the length of HelloWorld to 6 characters.

If that doesn't work, post which version of FORTRAN you're using.
Quote:Original post by Nitage
Try reducing the length of HelloWorld to 6 characters.

If that doesn't work, post which version of FORTRAN you're using.



did that, didnt help :( .
I'm sure I have the latest version as I just downloaded the compiler.

thanks again
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
It's been years since I touched Fortran but one thing I recall is that it wanted everything in particular columns. Try changing your code so that each statement begins in column 7. The error codes seem to back this up and sound like it's wanting data in the first column to be a line number.
-Mike
hmmm... got the prob.. I was editing the prog with TextEdit that apparently adds a bunch of lines to the code... all good now, Thanks!
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Quote:Original post by FreJa
hmmm... got the prob.. I was editing the prog with TextEdit that apparently adds a bunch of lines to the code... all good now, Thanks!


It was saving your document in RTF (Rich Text Format), which includes extra stuff to preserve information about text colour/font/size (which makes no sense at all to the compiler). You should be able to disable that (and/or set it on a per-file basis to save as plain text).

This topic is closed to new replies.

Advertisement