Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sqrt syntax

Status
Not open for further replies.

amiak

Programmer
Dec 17, 2002
41
US
I'm looking for a useful way to use sqrt thanks...
 
#include <math.h>
....
double a,b;
...
a=123.0

b=sqrt(a);
....

hnd
hasso55@yahoo.com

 
this code produces the following error message:

/tmp/ccM7zysm.o: In function 'main':
/tmp/ccM7zysm.o(.text+0x1c): undefined reference to 'sqrt'

I'm running freeBSD 4.5 on an IBM 560.

any idea what the problem is?
 
Maybe you have to link your program with the math library (using -lm or -lmath)? //Daniel
 
Daniel Bingo! The library must be linked.
hnd
hasso55@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top