This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: About log() in GCC


Quoting JN_Lin@utc.com.tw (JN_Lin@utc.com.tw):
> 
> 
> Dear :
> When I want to use "log" in my program, I must include the header
> file math.h.  But when I compiler my program ,some message showing  as
> following:
> 
>     Undefined                       first referenced
>     symbol                             in file
>     log                                 /var/tmp/cca0060l1.o
>     ld: fatal: Symbol referencing errors. No output written to a.out

Append -lm to your link line. I think this is the most frequently asked question
in all gcc-* newsgroups.

-lm links in the mathematical functions library libm.* I don't know, why
they were seperated from libc.* but it's the same on every UNIX i use.

Hope that helps,
Martin.

-- 
esa$ gcc -Wall -o ariane5 ariane5.c
ariane5.c: 666: warning: long float implicitly truncated to unsigned type
esa$ ariane5

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]