使用gfortran编译程序时,会出现以下错误:
quicksort.f95:73:25:
quicksort(ARR(1:J))
1
Error: Symbol ‘quicksort’ at (1) has already been host associated
quicksort.f95:77:25:
quicksort(ARR(I:N2))
1
Error: Symbol ‘quicksort’ at (1) has already been host associated
我创建的子程序具有以下代码
recursive subroutine quicksort(ARR)
implicit none
integer, dimension(:), intent(inout) :: ARR
integer I, J, X, AUX, N2
logical :: CONTINUA
N2 = SIZE(ARR)
if (N2 <= 2) then
if (N2 == 2) then
AUX = ARR(1)
if (ARR(1) > ARR(2)) then
ARR(1) = ARR(2)
ARR(2) = AUX
end if
end if
else
I=1; J=N2; X=ARR(N2/2)
CONTINUA = .TRUE.
do while (CONTINUA)
do while (ARR(I) < X)
I = I + 1
end do
do while (ARR(J) > X)
J = J-1
end do
if (I <= J) then
AUX = ARR(I)
ARR(I) = ARR(J)
ARR(J) = AUX
I=I+1; J=J-1
end if
CONTINUA = (I <= J)
end do
!BELOW ARE THE PROBLEM LINES
if (J > 0) then
quicksort(ARR(1:J))
end if
if (I < N2) then
quicksort(ARR(I:N2))
end if
end if
end subroutine quicksort
我甚至尝试重命名子例程,但错误仍然存在。我实际上不明白Symbol ‘quicksort’ at (1) has already been host associated
错误的真正含义。我在互联网上搜索但没有得到这个错误的含义。
有人能告诉我错误在哪里吗?