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

Re: gcc math functions



On Tue, 4 Nov 1997, Christopher Judd wrote:

> 	I have a PC with debian 1.3.1 installed (my first linux 
> installation). When I try to use the  math functions (exp, pow, etc.) in
> gcc I get a message like:
> 
> 	/tmp/cca016941.o(.text+0x5f): undefined reference to `exp'
> 
> On other systems I have used the "include <math.h>" was sufficient.  Is 
> there an additional step necessary or is my installation incomplete in
> some way ?
Other systems did not do it the correct way. The correct way is to add -lm 
in the final compile phase

eg
gcc -o Myexe file1.c -lm

This is called linking with the math library.

/----------------------------------------------------------------------------/
Daniel J. Mashao -- 
   daniel@comgate.ee.uct.ac.za             http://www.ee.uct.ac.za/~daniel
/----------------------------------------------------------------------------/


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: