title: undefined reference to in FORTRAN using one additional function
body: <p>I had the following code in a big file containing 5000 lines.</p>
  
  <pre><code>function w_de(a)
  real(dl) :: w_de, al
  real(dl), intent(IN) :: a
  
  if(.not. use_tabulated_w) then
      w_de = w_lam+wa_ppf*(1._dl-a)*alfa   !!! PLEASE JUST SEE THIS PART
  else
      al=dlog(a)
      if(al.lt.a_ppf(1)) then
          w_de=w_ppf(1)                   
      elseif(al.gt.a_ppf(nw_ppf)) then
          w_de=w_ppf(nw_ppf)             
      else
          call cubicsplint(a_ppf,w_ppf,ddw_ppf,nw_ppf,al,w_de)
      endif
  endif
  end function w_de 
  </code></pre>
  
  <p>this code works correctly and all components <code>w_lam, wa_ppf, alfa, tabulated_w</code> are defined in some places in 5000 lines of code. We do not need them in this question. PLEASE JUST SEE <code>w_de = w_lam...</code> LINE.</p>
  
  <p>Because of some reasons and som testing issue I have written the code above as</p>
  
  <pre><code>function wq(an)
  real(dl)::wq, an
  wq=w_lam+wa_ppf*(1._dl-an)*alfa
  end function wq
  
  function w_de(a)
  real(dl) :: w_de, al,wq
  real(dl), intent(IN) :: a
  
  if(.not. use_tabulated_w) then
      w_de = wq(a)     !! JUST SEE THIS PART
  else
      al=dlog(a)
      if(al.lt.a_ppf(1)) then
          w_de=w_ppf(1)                   
      elseif(al.gt.a_ppf(nw_ppf)) then
          w_de=w_ppf(nw_ppf)             
      else
          call cubicsplint(a_ppf,w_ppf,ddw_ppf,nw_ppf,al,w_de)
      endif
  endif
  end function w_de 
  </code></pre>
  
  <p>But compinig the second form of codes  gets an error</p>
  
  <pre><code>/tmp/ipo_ifortqAvaYt3.o: In function `lambdageneral_mp_w_de_':
  ipo_out3.f:(.text.hot00005+0xdbe): undefined reference to `wq_'
  ....
  make: *** [camb] Error 1
  </code></pre>
  
  <p>I do not understand what is the problem. Thank you</p>