OT: gcc math library

Kerry Hoath kerry at gotss.net
Thu Sep 5 08:33:12 EDT 2002


This is easy;
add -lm to the  link step.
You must link against libc and libm and you do that
with -lm on the linking step.
Check sox makefile for an example of this or any good C book.

Regards, Kerry.

On Thu, Sep 05, 2002 at 08:09:18AM -0400, Charles Hallenbeck wrote:
> I hope someone may have some quick advice for me on this one.
> 
> I have routinely been using the G++ compiler in my programming,
> and have recently rewritten some of my code in normal C instead
> of C++ for reasons of efficiency and portability. The rewrite was
> not difficult, and I finally got one package of about 2000 lines
> of code to compile without errors or warnings. However - the
> linking step failed when none of the math functions required in
> the program could be located by the GCC linker. The same
> functions in the C++ version compiled by G++ were found with no
> problem. The functions were: sqrt, log, log10, trunc, int,
> double, float, etc. The header file math.h was present (without
> it, compile errors result) but evidently the C math library could
> not be found.
> 
> I tried reinstalling my gcc.tgz and glibc.tgz packages to no
> avail. I am now heading for the howto's and docs to see what I
> can learn. Any help from you programmers out there would be
> greatly appreciated.
> 
> My system: Slackware 8.0, kernel 2.4.18, GCC 2.95.3
> 
> Thanks - Chuck
> 
> -- 
> The Moon is Waning Crescent (4% of Full)
> So visit me at http://www.valstar.net/~hallenbeck
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
> 

-- 
Kerry Hoath:  kerry at gotss.net kerry at gotss.eu.org or  kerry at gotss.spice.net.au
ICQ: 8226547 msn: kerry at gotss.net Yahoo: kerryhoath at yahoo.com.au





More information about the Speakup mailing list