Re: static link errors with libm

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

 



Jaap Eldering <eldering@xxxxxxxxxx> writes:

> On Sat, Aug 14, 2004 at 02:04:48PM -0400, Ishwar Rattan wrote:
> > Try -lm as the last command-line argument to gcc
> > -ishwar
> 
> Ok, this works. Thanks!
> 
> But why does it have to be last? I'd suppose only the order with respect
> to -static might matter.

Object files and libraries are searched from left-to-right so the
sin() function is not picked up when -lm appears first.

In C, the math library is separate from the main standard library for
historical reasons. In C++ you don't need a separate -lm so the g++
command works on its own.

-- 
Brian Gough

Network Theory Ltd,
Publishing "An Introduction to GCC" --- http://network-theory.co.uk/gcc/intro/

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux