Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Error on Random number generator

Jun_L_1
Beginner
563 Views

Hi! I have a question on calling the random number generator from IMSL. 

SUBROUTINE RANDN(NUMX, X, ISEED)
! THIS GENERATE NUMX RANDOM NUMBERS WITH MEAN 0 AND STANDARD DEVIATION 1
! THIS CALL FUNCTION RNSET TO GENERATE UNIFORM RANDOM NUMBER
! ISEED IS THE SEED NUMBER
! X IS THE OUTPUT FOR RANDOM NUMBERS
INCLUDE 'link_fnl_shared.h'
  USE IMSL_LIBRARIES
  IMPLICIT NONE
  INTEGER, INTENT (IN):: NUMX, ISEED
  INTEGER :: NX
  REAL, INTENT (OUT) :: X(NUMX)
  REAL :: PI,R1,R2
  REAL :: R(NUMX*2)
!  EXTERNAL RNSET, RNUN
 
  CALL RNSET(ISEED)
  CALL RNUN(R)

  PI = 4.0*ATAN(1.0)

  DO NX=1, NUMX
  R1 = -ALOG(1.0-R(2*NX-1))
  R2 = 2.0*PI*R(2*NX)
  R1 = SQRT(2.0*R1)
  X(NX)  = R1*COS(R2)
  ENDDO

END SUBROUTINE RANDN

The error message looks like below:

2>SIMULATION.F90
2>Linking...
2>FUN_SUPPORT.obj : error LNK2019: unresolved external symbol _RNSET referenced in function _FUN_SUPPORT_mp_RANDN
2>FUN_SUPPORT.obj : error LNK2019: unresolved external symbol _S_RNUN referenced in function _FUN_SUPPORT_mp_RANDN
2>Release\Simulation.exe : fatal error LNK1120: 2 unresolved externals

Could anyone help? Thanks!

0 Kudos
1 Reply
Jun_L_1
Beginner
563 Views

I figured it out. Thanks!

0 Kudos
Reply