Trouble with cc/f77

Phil Farrell farrell at tioga.Stanford.EDU
Fri Jan 25 06:43:43 AEST 1991


In article <1991Jan24.001055.3069 at ims.alaska.edu>
Don Rice (fnddr at acad3.alaska.edu) writes:
>A couple of cc/f77 problems have turned up (Ultrix 4.0/DS5000/Fortran 2.1)....
>... when trying to combine a main program written in C with a subroutine
>written in Fortran, the Fortran built-in functions aren't found:
>  > cc -o prog main.c fortsub.o -lF77 -lU77 -lI77 -lm
>  ld:
>  Undefined:
>  sinf
>  cosf
>  sqrtf

Is the C compiler even finding the libraries?  As installed, Fortran 2.1
libraries are in /usr/lib/cmplrs/f77, but the C compiler looks for 
those -lF77 etc directives in /usr/lib.  I created symbolic links
for libF77.a, libI77.a, and libU77.a from /usr/lib/cmplrs/f77 to /usr/lib
on my system to address this problem.

Secondly, you realize that the linker only searches a library once for 
any references on its current "unresolved" list.  If a routine from one
library calls one from another library that has already been searched, 
that will created an undefined reference.  You might play with the 
order of libraries on your command line, or even add another -l command
at the end to search the library a second time.

-Phil Farrell, Computer Systems Manager
Stanford University School of Earth Sciences
farrell at pangea.stanford.edu



More information about the Comp.unix.ultrix mailing list