I'm trying to convert Fortran 77 code to C++. I'm using gfortran compiler via cygwin. I've successfully converted most of the code but I couldn't run this subroutine due to its dependency on Random()
. According to the book I'm reading, the subroutine is
SUBROUTINE GAUSS(X,SIG)
IMPLICIT REAL*8(A-H)
IMPLICIT REAL*8(O-Z)
INTEGER SUM
SUM=0
DO 14 J=1,6
C THE NEXT STATEMENT PRODUCES A UNIF. DISTRIBUTED NUMBER FROM -32768 TO +32768
IRAN=Random()
SUM=SUM+IRAN
14 CONTINUE
X=SUM/65536
X=1.414*X*SIG
RETURN
END
At the top of the code, there are the following
C THE FIRST THREE STATEMENTS INVOKE THE ABSOFT RANDOM NUMBER GENERATOR ON THE MACINTOSH
GLOBAL DEFINE
INCLUDE 'quickdraw.inc'
END
Using this line
gfortran -std=legacy Listing_4_3.f90 -o test
I got this error
/tmp/ccQ2l529.o:Listing_4_3.f90:(.text+0x1b): undefined reference to `random_'
collect2: error: ld returned 1 exit status
How to make this code run?