Re: gcc questions

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

 



Dotan Cohen wrote:
On 11/27/05, Matthew Miller <mattdm@xxxxxxxxxx> 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>

The answer to this is that there is no "it". Creating a program
involves several steps. It may seem like you are doing one thing,
but really you are not. The "include" directive communicates with
the preprocessor (or compiler depending on how it is structured),
while the "-lm" communicates with the linker, which is
normally a completely separate program.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux