OT: gcc math library

jwantz at hpcc.noaa.gov jwantz at hpcc.noaa.gov
Fri Sep 6 12:25:03 EDT 2002


Hey Chuck,
I am answering you now in case someone hasn't replied already.  Did you 
remember to include the -lm option on the command-line or in your 
makefile?  E.g.:
gcc -o program program.c -Wall -D_GNU_SOURCE -lm


Hope this helps.

     Jim
On Thu, 5 Sep 2002, 
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
> 
> 





More information about the Speakup mailing list