Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

fortran - Error: Non-numeric character in statement at label (1)

This is the program I compile on ubuntu 14.04 using

f95 First.f -o First

and the program is

!My first program
program first
print *,'This is my first program'
end program first

And I get the following error

Error:Non-numeric character at statement label at (1)
First.f:2.1:

program first

How do you address this error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Rename your file from First.f to First.f90.

You have encountered an issue which is easily avoided. Compilers generally assume that .f files are written in what is known as fixed source form, which has been obsolescent since Fortran 90. With the .f90 suffix your compiler should expect to encounter free source form and not complain as it has done. In fixed source form, cols 1-6 in each line are reserved for a (numeric) statement label.

Now, use your favorite Fortran resources to understand, if you care, the differences between the two source forms.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...