Can't compile programs using functions in math.h

Martin Rothberg merothberg@hotmail.com
Tue Apr 2 14:36:00 GMT 2002



I am running redhat 7.2.  I can compile simple programs just fine, but I 
cannot compile programs the use functions such as sin or cos.  I need these 
as I am doing navigation calculations.  I have tried various things.  I 
confirmed that the compiler is finding math.h and the underlying 
mathcalls.h.  However, when I compile, I get:

[root@mercury root]# gcc -o junk test.c
/tmp/ccINr3XY.o: In function `main':
/tmp/ccINr3XY.o(.text+0x41): undefined reference to `cos'
collect2: ld returned 1 exit status

I am not sure why it fails.  I have attempted to build both on command line 
and via KDevelop (in case I forgot to set up something).  Both yielded the 
same result.  I even reinstalled the RPM's for gcc in case I had damaged the 
install, but the result was the same.  Are there environment variables I 
need to explicitly set to use the standard C headers and libraries?  Since 
the header files are intact, am I missing the library itself?  Please advise

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx



More information about the Gcc-help mailing list