- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
recursive function f(n) result(ff_result)
implicit none
integer::n,ff_result
if(n==0)then
ff_result=0
else if (n==1.or.n==2)then
ff_result=1
else
ff_result=f(n-1)+f(n-2)!+f(n-3) ! error occurs at this line.
! Error: The same named entity from different modules and/or program units
!cannotbe referenced.
endif
end function f
!*************************************************
program recursivation
implicit none
integer ::i
interface
recursive function f(n) result(ff_result)
integer::n,ff_result
end function f
endinterface
do i=1,10
print*,f(i)
enddo
pause
end program recursivation
! please help me,thanks a lot.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Turn off "Check generated interfaces" under the Fortran > Diagnostics.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much , administrator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By the way, this is a compiler bug that is in the process of being fixed. I'm puzzled as to why we're suddenly seeing multiple reports of it, as the bug has been there for a while...
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page