[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc 2.95 and Standard C



> Okay, I'm calmer now. Really. Promise. Ignore the knife I'm holding
> at my wrists -- it's a twelve-inch Gil Hibbert butterknife, I swear.

Calm is good.  Especially when learning Unix!!!    :-)

> >It was the linker complaining, not the compiler.
> 
> Oh, duh. On closer inspection it, well, it isn't *obvious* that a linker
> is complaining, but there is a reference to an .o file in the error.

By default, gcc creates the object (.o) file, it runs the linker,
then it removes the .o file.

> >It's the system library that contain the math functions.
> >Separate from libc.
> 
> But how am I meant to find out which lib to link to for every piddlin'
> function my widdle heart desires?

I was afraid you'd ask that.  I've been doing this for a long time,
and I honestly don't remember where it's documented.  Perhaps someone
else can help.

If I get stuck, I whip up a little script that runs "ar t" on the .a
libraries grep'ing for the function I'm looking for.  I admit that's
a HACK, and it's probably in documentation somewhere.

> (It helps to know where to find them, too -- not in /lib, as libc.so.6 et
> al., but in /usr/lib, as libm.a. I can guess what the 'a' stands for, but

The linker uses the ".so" files by default.  
Those are the dynamic libraries.

The ".a" files are the static libraries.

> what is the difference between /lib and /usr/lib (or is there,
> aside from the difference between / and /usr anyway?))

The linker looks in both /lib & /usr/lib paths by default.

The libraries in /lib are the ones required at boot time
(since /usr may not be mounted at boot time, if it's on a 
different partition).  The rest of the libraries are in /usr/lib.

> >Armstrong International, Inc.
> >Three Rivers, Michigan  49093  USA
> 
> Ah, yes. I know where that is. I drive air packages in 3R Saturdays. :)

Cool!

> And thank you. It worked fine the first time. <blush>

Glad to help!

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------