Fatal error LNK1120: 2 unresolved externals

  • Thread starter Thread starter nnnnn
  • Start date Start date
  • Tags Tags
    Error
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 10K views
nnnnn
Messages
5
Reaction score
0
********************************************************
Hi , dear friends;
May you please kindly help me with this problem .?
Running my program (fortran90 in compaq visual fortran.6..) leads to this
messages:

((( Linking...
simpson-3.obj : error LNK2001: unresolved external symbol _FERMI@8
simpson-3.obj : error LNK2001: unresolved external symbol _A_INTEGRAL@4
Debug/simpson-3.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe. )))
" FERMI " is a function which is used in my program( it is called in the subroutin) .And
" A_INTEGRAL " is a one dimensional array.
What do you suggest ?? I copy the program here (if it helps) .

Best Regards
N. M.
--------------------------------------------------------------------------------------------
----------------------------------
-------------------
program INTEG_3Ghaneh

real(8),parameter ::Pi=3.14
real(8),parameter ::Temp=1
REAL(8) ::a,b
Integer :: n !n : an even number
integer :: i,j,i1,i2,i3
real(8) :: NN,mo
complex(8),parameter :: ii = (0, 1)

n = 20
a =-10
b = 10
mo= 1

CALL Simpson(n,a,b)
open(unit=160,file = "out3Ghaneh.txt")

do i=-n/2+1,n/2-1
write(160,*)," Integral = ",a_Integral(i)
enddo
pause
!/////////////////////////////////////////////////////////////
contains
!++++++++++++++++++++++++++++++++++++++++++++++++++++++
!function : fermi !

real(8) function fermi(e,mo)
implicit none
real(8),intent(in) :: mo
complex(8),intent(in) :: e(-n/2:n/2)

if(dreal(e(i)) < mo)then
fermi = 1.
else
fermi = 0.
end if

end function fermi

!////////////////// Simpson Integrals Subroutine /////////////////////////////////////
Subroutine Simpson(n,a,b)
Integer,intent(IN) :: n
Real(8),intent(IN) :: a,b
Real(8) :: delta_e,m !n must be an even number
REAL(8) :: wn(-n/2:n/2),e(-n/2:n/2)
complex(8) :: F(-n/2:n/2,-n/2:n/2,-n/2:n/2,-n/2:n/2)
complex(8) :: a_integral(-n/2:n/2),b_Integral(-n/2:n/2,-n/2:n/2),c_Integral(-n/2:n/2,-n/2:n/2,-n/2:n/2)
real(8), external :: fermi
delta_e = ( b - a )/n

!
! Here you introduce your integrant :
!
NN=fermi(e(i1),mo)*fermi(-e(i2),mo)*fermi(e(i3),mo)+fermi(-e(i1),mo)*fermi(e(i2),mo)*fermi(-e(i3),mo)

do i=-n/2,n/2
wn(i) = (2*i + 1)*Pi*Temp
e(i) = wn(i)
F(i,i1,i2,i3)=NN/(ii*wn(i)-e(i1)+e(i2)-e(i3)) !F(i)=NN/(ii*wn(i)-e(i1)+e(i2)-e(i3))

end do

c_integral(i,i2,i3)=F(i,-n/2,i2,i3)+F(i,n/2,i2,i3)

Do i1=(-n/2)+1,(n/2)-1
m=mod(i1,2)
c_integral(i,i2,i3)=c_integral(i,i2,i3)+2*(1-m)*F(i,i1,i2,i3)+4*m*F(i,i1,i2,i3)

END DO
c_integral(i,i2,i3)=c_integral(i,i2,i3)*delta_e/3
!*********************************************************second fold of Integral************************************
b_integral(i,i3)=c_integral(i,-n/2,i3)+c_integral(i,n/2,i3)

Do i2=(-n/2)+1,(n/2)-1
m=mod(i1,2)
b_integral(i,i3)=b_integral(i,i3)+2*(1-m)*c_integral(i,i2,i3)+4*m*c_integral(i,i2,i3)
END DO
b_integral(i,i3)=b_integral(i,i3)*delta_e/3
!*********************************************************third fold of Integral*************************************
b_integral(i,i3)=c_integral(i,-n/2,i3)+c_integral(i,n/2,i3)
Do i2=(-n/2)+1,(n/2)-1
m=mod(i1,2)
a_integral(i)=a_integral(i)+2*(1-m)*b_integral(i,i3)+4*m*b_integral(i,i3)
END DO
a_integral(i)=a_integral(i)*delta_e/3
!********************************************************************************************************************
END Subroutine Simpson
!/////////////////////////////////////////////////////////////
END program INTEG_3Ghaneh
 
Physics news on Phys.org
Is the code you showed in separate files? You are getting linker errors, which means that the linker cannot find the code associated with the symbols _FERMI and _A_INTEGRAL.

It's possible that your configuration file doesn't include all of your source files. Otherwise, I don't see anything obvious.