fortran - Undefined symbols for architecture x86_64: gfortran -


hi i'm trying compile fortran code written else in believe f77 (.for extension). error i'm getting is:

undefined symbols architecture x86_64:   "_random_", referenced from:       _pms_ in ccx1qzwd.o ld: symbol(s) not found architecture x86_64 collect2: error: ld returned 1 exit status 

i'm not posting code i've been searching online error means can start searching solution can't find helpful information. have no previous fortran experience! on meaning of error appreciated. i'm using mac , section includes "random" part of subroutine:

double precision random  1 j=1,m       w(j)=dw+real(j*2-1)*dw/2.0       w1=w(j)*w(j)*w(j)*w(j)*w(j)       vel1=vel*vel*vel*vel*w1/w(j)       vel1=-6844.0697/vel1       gw(j)=0.77898/w1*exp(vel1)       phi(j)=random()*8.0*atan(1.0) 1     continue 

i using: gfortran seasim.for compile

thanks in advance advice!

ok, looks you're not providing linker library containing implementation of random. dig around , find such library, modify linkage, , see how goes. easier replace call random call gfortran intrinsic rand returns number uniform distribution between 0 , 1. that's suggest do. consult documentation further details.

a better approach use now-standard random_number that's subroutine , require more of modification program.

i have nagging suspicion if step take build program execute gfortran seasim.for @ command-line may missing linking other necessary libraries won't surprised if report failure.

this line

double precision random 

declares random double precision thing. function returning value rather variable holding value made clear later use of random(). compiler indifferent location of code implementing routine, linker not.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -