- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am modernizing legacy code, replacing statement functions through internal functions. While compiling the files individually no error occurs. If I am trying to rebuild the project or compile them all together I am getting link error lnk2019 and lnk1120, telling me the subroutine above calling the subroutine test1 containing the internal function can not link.
If I am using the statement function everything works fine...
Here are the code snippets:
subroutine test1 (..., xk, ... )
use Flowfield_size_control_mod, only : KX, LX, IORD, KXMAX, KXIMAX, LXMAX, LXIMAX
use Precision_mod, only : DP
implicit none
![ code ]
dimension :: xk ( -IORD: KXIMAX, -IORD : LXIMAX )
dimension :: xkth ( 0 : KXMAX, 0 : LXMAX )
real ( kind = DP ) :: xk, xkth
! old statement function
! ABL(XM2,XM1,X,XP1,XP2)=(XM2-8.D0*XM1+8.D0*XP1-XP2)/12.D0
![ code ]
DO 52 L=0,LX
DO 53 K=0,KX
XKTH(K,L)=ABL(XK(K,L-2),XK(K,L-1),XK(K,L),XK(K,L+1),XK(K,L+2))
53 END DO
52 END DO
![ code ]
contains
! new internal function
real ( kind = DP ) function abl ( xm2, xm1, x, xp1, xp2 ) result ( ret_val )
implicit none
real ( kind = DP ), intent ( in ) :: xm2, xm1, x, xp1, xp2
real ( kind = DP ) :: ret_val
ret_val = ( xm2 - 8.0_DP * xm1 + 8.0_DP * xp1 - xp2 ) / 12.0_DP
end real function abl
end subroutine test1
Any ideas?
Kind regards,
Martin
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lorri,
from my point of view the function is not called from the outside / there is no other function abl called in the project. I even tried placing the function in a module and provide it as an external function with the same result. Init.f90 is the subroutine calling test1.f90.
link errors are:
error LNK2019: unresolved external symbol "_test1" in function "_init". init.obj
fatal error LNK1120: 1 unresolved external Debug\project.exe
Due to the fact, that I am a newbie with ifort, I weren't able to extract more detailed error messages at the moment. Respectively I don't see why the subroutine stays unresolved, when I am replacing the statement function and leave the rest unchanged.
By the way I am using Intel(R) Visual Fortran Compiler XE 13.1.3.198 [IA-32]. Thanks for the help! -- Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ mecej4: You're right, your rebuild works fine on my system as well in the mentioned version. Kind of funny is, that I don't get the error with Intel(R) Visual Fortran Compiler XE 14.0.2.176 [IA-32], however several other link errors, which were not there before. I'll post some code right after I checked some other issues. I don't want you wasting your time... Thanks a already!
@ Lorri: This one goes on me. I re-typed and translated it, because my versions aren't talking english. I'll check on the properties and do as you suggest. Thanks a lot for support and the help!
If there are still difficulties I'll write again.
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
an update to Intel(R) Visual Fortran Compiler XE 14.0.2.176 [IA-32] and a clean re-build of the project did the job. Also the compiler doesn't like the double declaration of ret_val in the function declaration and inside the function itself.
Thanks to all for the help and the support.
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page