Simple Unresolved (Windows)

I know this is very old ground, but I still can’t get it to work… I’ve just updated my installation to 11.4 on Windows 7, 64-bit and I can’t get the following to link:

program testrand
integer i
double precision rand
external rand

do i=1,20
    print *,'rand(0)', rand(0)
enddo 
end

Which yields:

$ pgf90 testrand.f
pgf907frW3ZQaaBpMS.obj : error LNK2019: unresolved external symbol rand_ referenced in function MAIN_
testrand.exe : fatal error LNK1120: 1 unresolved externals

What’s the problem here?

Hi Jim,

Since ‘rand’ isn’t a standard routine in Fortran it’s implementation can change from platform to platform. On Windows, try using ‘drand’ instead or better yet the standard ‘random_number’ intrinsic.

Hope this helps,
Mat

Thanks Mat. RANDOM_SEED and RANDOM_NUMBER are what I needed. Thanks for that. Just porting…