From: Ryan Mcfall (mcfall@cs.hope.edu)
Date: 01/28/93


From: mcfall@cs.hope.edu (Ryan Mcfall)
Subject: Re: gcc 2.3.3 problem
Date: Thu, 28 Jan 1993 15:48:15 GMT

In article 4734@hp9000.csc.cuhk.hk, a080700@hp9000.csc.cuhk.hk (Stephen Wong S M) writes:
> I'm using linux 0.99pl4/SLS 1.0/gcc 2.3.3/lib 4.2 and I test the
> gcc compiler with the following program:-
>
> test_sqrt.c
> #include <math.h>
> #include <stdio.h>
> main()
> { double a;
> a = 2;
> printf("square root of 2 is %f\n", sqrt(a));
> }
>
> I use the following command line to compile:-
> gcc -lm -o test_sqrt test_sqrt.c
>
> but I got the following error message:-
> /usr/tmp/cca001331.o: Undefined symbot _sqrt referenced from text segment
>
> Then I tried another command line:-
> gcc -o test_sqrt test_sqrt.c /usr/lib/libm.a
>
> and succeed.
>
> My question is, is it a bug in gcc 2.3.3/lib 4.2 (libm.a), or something
> I misunderstand?
>

I've run into the same problems when trying to link in other libraries.
gcc 2.3.3/lib 4.2 does not seem to be able to find the files unless you give
it a full pathname. Including the -L/usr/lib options does not help either.

Ryan McFall
mcfall@cs.hope.edu