gcc questions

Peter Gordon admin at ramshacklestudios.com
Sun Nov 27 09:05:08 UTC 2005


On Sun, 2005-11-27 at 10:32 +0200, Dotan Cohen wrote:
> On 11/27/05, Matthew Miller <mattdm at mattdm.org> wrote:
> > On Sun, Nov 27, 2005 at 12:57:29AM +0200, Dotan Cohen wrote:
> > > > gcc -lm 1_3.c
> > > Thank you, it compiled now. I just spacebar'ed about 100 times in the
> > > gcc man page looking for the "m" option that you mention. I did find
> > > the "l" option (search the library named library when linking), but
> > > not the "m" option.
> >
> > Right -- "m" isn't an option, but actually the name of the library. Well,
> > actually, the library is "libm.so", but the -l assumes a prefix of lib and a
> > suffix of .so.
> >
> 
> Why doesn't it include the math library when I put at the top of the file:
> # include <math.h>
> ?

It did. Rather, it allowed you to call the functions from within the
math library. However, since the source code only had prototypes for
those functions, you have to tell GCC where it finds the actual
*implementation* of those functions, so it can create appropriate
output code. That's my understanding of it, anyway.
-- 
Peter Gordon (codergeek42)
GnuPG Public Key: 0xDA3634D7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20051127/e021478d/attachment-0002.bin 


More information about the users mailing list