I am trying to compile a fortran program that uses a bunch of modules. I get an error when I compile it, and it drives me crazy. The error occurs due to the addition of one subroutine and occurs when I try to recompile the program:
The main program contains these two lines:
-
call read_step(nStepOne,molOne)
call read_step(nStep,mol)
-
This calls one of the routines in the fileio.f90 file:
-
subroutine read_step(n,tape)
implicit none
integer, intent(in) :: tape
integer, intent(out) :: n
character(len=6) :: dum
rewind(tape)
read (tape,*)
read (tape,*) dum, n
rewind(tape)
return
!
end subroutine read_step
-
When I try to compile it, the following error occurs:
ifort -o SpIdMD.x *.o -static-intel -openmp
SpIdMD.o: In function `MAIN__':
SpIdMD.f90:(.text+0x3b2): undefined reference to `read_step_'
SpIdMD.f90:(.text+0x3c5): undefined reference to `read_step_'
make: *** [SpIdMD.x] Error 1
Other subroutine calls in the same module did not give any error, and I just do not see the difference between the calls of the "old subroutines" and the one I just created.
An example of one of these "old routines" that makes no complaints is:
In the main program:
call get_dim(n_atom,nSnap,mol)
In file.f90 file:
subroutine get_dim(n,n_snap,tape)
implicit none
integer,intent(in) :: tape
integer,intent(out) :: n, n_snap
integer :: m
rewind(tape)
read (tape,*,err=1,end=2) n
rewind(tape)
m = 0
do while (.true.)
read (tape,*,err=1,end=3)
m = m +1
end do
3 n_snap = m/(n + 2)
if (m.ne.(n_snap*(n + 2))) stop 'unexpected end of input file'
rewind(tape)
return
!
1 stop 'error in input file'
2 stop 'unexpected end of input file'
end subroutine get_dim
, . , - . !