Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bad file in open!

Status
Not open for further replies.

milenko76

Technical User
Mar 26, 2010
100
PT
I am trying to make the program but I get this:
f77 -O1 -c eik.f -o eik.o
MAIN:
Error on line 76: bad file in open
Error on line 76: non-character control clause
Why?
 
common/time/t(400,400),s(0:400,0:400)
character*20 fname
open(13,file='eik.out',status='unknown')
open(11,file='eik.para',status='unknown')
open(21,file='velo',status='unknown')
read(11,*) dh
read(11,*) is,js
print* ,'*******************************************************'
print* ,' '
print* ,' Wave front calculation by the finite difference method'
print* ,' '
print* ,' Ping Zhao '
print* ,' Department of Exploration Geophysics '
print* ,' Curtin University '
print* ,' 10/10/94 '
print* ,' '
print* ,'*******************************************************'
print* ,'enter input file name for velocity field'
read(*, 1003) fname
1003 format(a20)
open(12,file=fname,status='unknown')
read(12,*) nx,nz
do 901 i=1,nx
 
Do you have a tab or control character on the line? If you are on Linux, open the file in vi, type se li.

You will see a $ at the end of each line. Have a look at line 76. Do you see anything that shouldn't be there?
 
I do not have vi,I have made some arguments change in soubrutines still I get:
/usr/bin/f77: No input files specified
This is make makefile:
F77=f77
FFLAGS= -O1
# Executables
eik: eik.o eik.out vel1 eik.para velo
$(F77) $(FFLAGS) -o eik.o
# Object files
eik.o: eik.f eik.out vel1 eik.para velo
$(F77) $(FFLAGS) -c eik.f -o eik.o
Anyway xwb thanks for your help.
 
Try make -d

It will tell you what make is trying to do
 
/usr/bin/ld.real:eik.para: file format not recognized; treating as linker script
/usr/bin/ld.real:eik.para:1: syntax error
collect2: ld returned 1 exit status
Reaping winning child 0x00bbedc0 PID 12136
Removing child 0x00bbedc0 PID 12136 from chain.
This is just part of what make -d gives me.
It seems that compiler can not recognize input files.Where is the probelm in the makefile or in the code?
 
Try this from the command line
Code:
f77 -O1 eik.f
Does it create a file called either eik or a.out? This is the default behaviour
If that is OK then try
Code:
f77 -O1 -c eik.f
This should create eik.o. -c says create object file but do not link. If that works, try
Code:
f77 -o eik eik.o
This should create the executable eik from eik.o
If all that works, your makefile should look like
Code:
F77=f77
FFLAGS= -O1
# Executables
eik: eik.o 
    $(F77)  $(FFLAGS) -o eik eik.o 
# Object files
eik.o: eik.f eik.out vel1 eik.para  velo 
    $(F77)  $(FFLAGS) -c eik.f -o eik.o
 
xwb thanks a lot for your tremendous help!
it is working now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top