Date: Sat, 6 Feb 1999 19:57:04 -0500 From: Chris Johnson <cjohnson@palomine.net> To: Keith Anderson <keith@apcs.com.au> Cc: questions@FreeBSD.ORG Subject: Re: math.h ? Message-ID: <19990206195704.A23866@palomine.net> In-Reply-To: <XFMail.990207113238.keith@apcs.com.au>; from Keith Anderson on Sun, Feb 07, 1999 at 11:32:38AM %2B1100 References: <XFMail.990207113238.keith@apcs.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 07, 1999 at 11:32:38AM +1100, Keith Anderson wrote: > HI All, > > Below I have a very simple 'c' program but I can't make it work !! What am I > doing wrong, it will not compile? > > Any help would be great > > Thanks > > Keith > > <snip test.c> > #include <math.h> > > main () > { > double x = 64; > double ans; > ans = sqrt(x); > > printf("ans = %lf\n",ans); > > } > > </snip test.c> > > keith@wis~>cc test.c > /var/tmp/ccV145121.o: Undefined symbol `_sqrt' referenced from text segment You've got to link it with libm, like so: cc -lm test.c Chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990206195704.A23866>