I had the following code in a big file containing 5000 lines.
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
this code works correctly and all components w_lam, wa_ppf, alfa, tabulated_w
are defined in some places in 5000 lines of code. We do not need them in this question. PLEASE JUST SEE w_de = w_lam...
LINE.
Because of some reasons and som testing issue I have written the code above as
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
But compinig the second form of codes gets an error
/tmp/ipo_ifortqAvaYt3.o: In function `lambdageneral_mp_w_de_':
ipo_out3.f:(.text.hot00005+0xdbe): undefined reference to `wq_'
....
make: *** [camb] Error 1
I do not understand what is the problem. Thank you