0

I am defining function z such as

       double precision function z_funcn(A1,A3,A4,A5,A6)     
      
       double precision A1,A3,A4,A5,A6
           
          z=     (-2*A1*A5*A6+A3*A4)
        z_funcn=z
          
        return
        END function

Similarly I have defined another function which requires the value of z, which I have defined in function therefore I have defined the t_funcn as,

       include 'z_func.f'
     
       double precision function t_funcn(s,xp,xg,kpg,kpp,phip,phig,
     -  PT,PL,KDM,ED,MD,Mc,z)                    
      
       double precision PT,PL,KDM,ED,MD,Mc,s
       double precision xp,xg,kpg,kpp,z_funcn
       double precision A1,A3,A4,A5,A6,z
      
       
        z=z_funcn(A1,A3,A4,A5,A6) 
       
       
           t=    (Sqrt(s)*(1 + Kpg**2/(s*xg**2))*xg*(Mc**2 + 
           (ED + Sqrt(-KDM**2 + PL**2 + PT**2))**2/z**2)*z).......

       t_funcn=t
          
        return
        END function

Now I need both these function in my main program abc.

I included both the functions in my main program abc and when I compile this file, I recieved this type of error,

gfortran abc.f
/usr/bin/ld: /tmp/ccJLkSaE.o: in function `MAIN__':
unplrized.f:(.text+0x81b1): undefined reference to `t_funcn_'
collect2: error: ld returned 1 exit status

I need help how to deal with this problem.

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
  • 1
    Welcome, please take the [tour] and read [ask] and [mcve]. You should show the complete code. – Vladimir F Героям слава May 30 '22 at 05:40
  • 1
    *"I included both the functions in my main program abc"* I think I know what the problem is but unfortunately I can only guess because these words are not 100% clear. You should really show the complete code. Did you actually put `double precision t_fucn` into your main program? Did you put those functions behind `contains`? If you put your functions behind contains, you have to delete those declarations like `double precision z_funcn`. – Vladimir F Героям слава May 30 '22 at 05:41

0 Answers0