Fortran compilation error - undefined reference -


i trying compile fortran program uses bunch of modules. obtain error when compile it, , it's driving me crazy. error originated addition of 1 subroutine , takes place when try recompile program:

main program contains these 2 lines:

--

call read_step(nstepone,molone) call read_step(nstep,mol) 

--

this calling 1 of subroutines in file "fileio.f90":

--

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 try compile it, following error arises:

ifort -o spidmd.x *.o -static-intel -openmp  spidmd.o: in function `main__': spidmd.f90:(.text+0x3b2): undefined reference `read_step_' spidmd.f90:(.text+0x3c5): undefined reference `read_step_' make: *** [spidmd.x] error 1 

other calls subroutines in same module did not give error, , don't see difference between calls "old subroutines" , 1 created.

an example of 1 of these "old subroutines", not give complaint, is:

in main program:

call get_dim(n_atom,nsnap,mol) 

in fileio.f90:

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 while (.true.)    read (tape,*,err=1,end=3)    m = m +1 end 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 

i have absolutely no idea why behavior. i'd grateful if me solve nightmare. thanks!

if definition of subroutine read_step in module, have either forgotten add use statement module top of main program, or relevant procedures in module not public.

with compiler (and others) linker names module procedures consist of module name followed 'mp' (case may vary) followed procedure name, various amounts of leading , trailing underscores salted taste. linker error doesn't have of "mangling", indicates when compiling scope procedure reference, compiler doesn't think procedure module procedure.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

node.js - Bad Request - node js ajax post -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -