Find the answer to your Linux question:
Results 1 to 4 of 4
I have been trying to get my gcc f77 compiler working right, but am failing to do so. I can compile simple programs so I know it works a bit. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    rb
    rb is offline
    Just Joined!
    Join Date
    Jun 2005
    Posts
    3

    fortran libraries


    I have been trying to get my gcc f77 compiler working right, but am failing to do so. I can compile simple programs so I know it works a bit. However I was given some code to compile that uses function calls to "drand" and "drandm". When I try to compile this code it won't work.

    Is this because these calls are not included in the standard gcc library? Or am I not linking them properly?

    A point in the right direction would be most apreiciated.

    I am running linux redhat 9.

    Thank you,
    Ryan

  2. #2
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    You have to include the math library: add -lm to the command line

  3. #3
    Linux Newbie jamey112's Avatar
    Join Date
    May 2005
    Location
    Nashville, TN
    Posts
    212
    fortran is great. i learned it in high school. i found our instructors root password to our server, and would log in as root and boot the other people off while in the middle of their programs. fun times.
    Today I fell and felt better, Just knowing this matters, I just feel stronger and SHARPER!!!, Found a box of sharp objects, What a beautiful THING!!! Box of Sharp Objects - The Used

  4. $spacer_open
    $spacer_close
  5. #4
    rb
    rb is offline
    Just Joined!
    Join Date
    Jun 2005
    Posts
    3
    Ok still not working with the -lm. Here is a peice of the program I was given. Keep in mind that this program was not written or ever compiled on my system. And that I only really know C and java, so I may be narrow minded.

    c
    c My stuff ...
    character*1 tp
    character*2 newtp
    character*6 name(100),li
    character*12 in,dat,pera
    integer inew(103),iold(85000,103),iadj(720),iperm1,iperm2, ifail
    integer ipera(5040,7),iplan,ilast,ir,ii,jj,inam(100,100)
    integer ifeas,ilpp,ilp,iseed,iout,inflp,ifalp,ideglp,iff,i eqs
    integer iffin, iffrk, itot,itmp,ikill,ihh(100),iangle,iaok
    real*8 m(200,721),rhs(200),obj(721),shft(100),primal(721, 100)
    real*8 mm(100,100),mms(100,100),x(100,1),centr(100),hh(10 0)
    real*8 min,minx,radius,xer,t,newrhs,xsum,ndv1,ndv2,cos
    real*8 xnew(103),xold(85000,103),tmp1,ttt,focus,anglet,an g
    real*8 xa(100,100),xb(100,100),xc(100,100),angle(100)
    real*8 drandm
    common /mblok/ m
    common /mmblok/ mm,x
    common /xblok/ xnew,inew
    common /oblok/ xold,iold,iplan
    c
    li='------'
    minx = 1000000.d0
    inflp = 0
    ifalp = 0
    ideglp = 0
    iff = 0
    ieqs = 0
    iffin = 0
    iffrk = 0
    ikill = 1
    iangle = 0
    anglet = 0.d0
    c
    c Read in a parameters from input ...
    c Tour's file ...
    read(5,1) in
    c Past faces file ...
    read(5,1) dat
    c Starting extreme point ...
    read(5,2) iex1
    c Ending extreme point ...
    read(5,2) iex2
    c Number of times per extreme point ...
    read(5,2) ishot
    c Magnitude of fuzzines about extreme point under study ...
    read(5,*) radius
    c Permutation file that grows faces fast - sometimes ...
    read(5,1) pera
    c Random number generator seed ...
    read(5,*) iseed
    ttt = drandm(iseed)


    The error is at the last line there. I'm confused because wasn't "drandm" defind as a real variable at the top? Why is it being used as a function call? I know the point is to get a double presicion random variable, perhaps there is another way.

    .. frustrating

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •