I am new to PGI Visual FORTRAN. I am using PGI Visual FORTRAN 2010 64/32 bit. I am migrating from Lahey to PGI, and I am getting a linking error that I am not familiar with. When I compile the code, I get the following error:
Linking…
superprop4_impedance_MkII_BV26.obj : error LNK2019: unresolved external symbol _RAND@4 referenced in function _PPSO@92
superprop4_impedance_MkII_BV26.obj : error LNK2019: unresolved external symbol _WSPLINE@52 referenced in function _POPT@92
C:\AA My Work\FORTRAN Trials\First_Try\Prop_Try\Test_Prop\Test_Prop\Win32\Debug\Test_Prop.exe : fatal error LNK1120: 2 unresolved externals
Test_Prop build failed.
RAND is the intrinsic pseudorandom number generator function in FORTRAN, and WSPLINE is a subroutine created in the .f file. Does anyone have an idea why I am getting the linking error? I’ve searched online, and the closest answer I could come by is that I may need an extra library included, but that is as far as I could get. Thank you for any help.
For RAND extension, the problem is on Windows we need to using two different functions, RAND1 and RAND2. RAND1 is used when you don’t have an argument and RAND2 is used when passing in a seed. While you can change your program to use RAND2, I would suggest moving to the standard RANDOM_NUMBER intrinsic instead.
As for WSPLINE, in Win32, the default is to append the size in bytes of the argument list to the end of symbol name. My best guess is that the type of the arguments don’t match between the callee and the caller.
You can work around this issue by changing the calling convention. From your Project’s property pages (under Fotran->External Procedures), try changing the calling convention to “UNIX” and recompile. This will change the behavior to not include the argument size in the symbol name. For further details on Win32 calling conventions, please refer to chapter 11 of the PGI User’s Guide.
Thank you so much for your prompt reply. I wasn’t aware of the random number generator function call changes/updates. I have been working with some very old F77 standard codes on old compilers, so it hasn’t come up. I’m trying to bring them into this century. :)
I’ll follow the call statements throughout the code. It makes sense that those discrepancies would lead to a linking not a compiling error.
Thank you very much for addressing my issues. I imagine that they must be rudimentary for more experienced users, but no one becomes an experienced user without asking a few simple questions along the way. I appreciate your time and expertise.