Sign in to follow this  
FreJa

need help with fortran

Recommended Posts

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

Share this post


Link to post
Share on other sites
Try reducing the length of HelloWorld to 6 characters.

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this