automake
[Top][All Lists]
Advanced

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

Re: Getting 'undefined reference' errors during linking but I thinkI inc


From: Steve M. Robbins
Subject: Re: Getting 'undefined reference' errors during linking but I thinkI included all libraries?!?
Date: Fri, 02 May 2003 15:19:07 -0400
User-agent: Mutt/1.5.4i

On Fri, May 02, 2003 at 10:46:42AM -0700, address@hidden wrote:
> Rusty
> 
> I was thinking about your comment that -L's must come before -l's but
> that it is /not/ necessary for -l's to go AFTER .o files and main()'s that
> call thosefunctions......

That's not what he said.  The "-L" options may preceed the object files,
but the libraries themselves ("-l" options) definitely must follow
and must be in the correct order ...

> (I verified this is true by making a toy program that uses pow function
> and thentrying 'gcc -lm test.c' and 'gcc test.c -lm'. -> both worked.)

... unless your libraries are shared objects.  In that case it doesn't
matter (at least on linux).  Probably libm is shared.  Try this again
using "gcc -static -lm test.c".

-S





reply via email to

[Prev in Thread] Current Thread [Next in Thread]