Jump to content
  • Advertisement
Sign in to follow this  
FreJa

need help with fortran

This topic is 4355 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!