LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2014, 03:30 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Rep: Reputation: Disabled
Where is the error in a Gfortran file?


Hi there. My environment is: Win 7==>Oracle VB=>>Ubuntu==>Gfortran. I am trying to restore my previous FORTRAN skills starting with something elementary. This is the code:

Code:
#Attempt to read a few files in the directory and compare the values
program main
   real :: val
   900 format (F8.3)
   open (unit=1, file = "gray_disk_impr_100_256_128.dat", status = 'old')
   read (unit=1,900) val
   write (unit=6,900) val
   close (unit=1)
end
While compiling I get this error. It points to read and write statements (identical errors). The pointer points to the number 900 (format). It says:

Code:
fortran_1.f08:6.16:

   read (unit=1,900) val
                1
Error: Syntax error in READ statement at (1)
You can see that the source code file extension is .f08. I also tried to use an asterisk instead of a numbered format statement and it gave me an error. Where is the problem?

Thanks, - Alex

P.S. Also Is there a description of all error codes for GFortran?

Last edited by AlexBB; 10-18-2014 at 03:35 PM.
 
Old 10-18-2014, 04:00 PM   #2
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Original Poster
Rep: Reputation: Disabled
OK, I found the error:

The read statement should have been:

read(1,900), that's it. "unit" killed it. The same is of course true for the write statement. The last unresolved issue I have is a warning: illegal preprocessing directive. It does not say what kind. I really do not have any. Thanks.
 
Old 10-19-2014, 03:06 AM   #3
ndc85430
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 92

Rep: Reputation: Disabled
Yes you do - your first line. You use '!' to denote comments in Fortran, not '#'.
 
Old 10-19-2014, 11:42 AM   #4
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Original Poster
Rep: Reputation: Disabled
Wow, it worked! It may be the most valuable suggestion I have received here for some time. Appreciate it. Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Gfortran compilation error. Why? AlexBB Linux - Newbie 2 05-04-2014 10:33 AM
Does gfortran has issue working with the file as I/P and O/P ?? parekhharsh_j Linux - Newbie 6 06-17-2011 08:39 AM
"gfortran:error trying to execute f951 and execvp: no such file or directorry kandhakumar Linux - Software 1 06-01-2009 09:37 AM
gfortran runtime error saray Linux - Software 1 05-02-2009 10:56 AM
Gfortran compile error aukuntin Linux From Scratch 2 01-28-2007 08:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration