Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!ucsd!ucbvax!agate!shelby!morrow.stanford.edu!tioga.Stanford.EDU!farrell From: farrell@tioga.Stanford.EDU (Phil Farrell) Newsgroups: comp.unix.ultrix Subject: Re: Trouble with cc/f77 Message-ID: <1991Jan24.194343.5054@morrow.stanford.edu> Date: 24 Jan 91 19:43:43 GMT References: <1991Jan24.001055.3069@ims.alaska.edu> Sender: news@morrow.stanford.edu (News Service) Organization: Stanford Univ. Earth Sciences Lines: 28 In article <1991Jan24.001055.3069@ims.alaska.edu> Don Rice (fnddr@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@pangea.stanford.edu