Thanks, that did the trick.
Payne


>
>Try adding a -lm to the command you are using to compile and link.  This
>tells the compiler to link in the math library.  That is your problem.
>
>-Eric
>
>-----Original Message-----
>From: Payne Stanifer [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, June 10, 2000 6:26 PM
>To: [EMAIL PROTECTED]
>Subject: [expert] C problem with math.h and gcc
>
>
>To those who can help me:
>I am a beginning C programmer and compiler errors are to be expected, but
>this one is strange. The situation is that I was writing a program to do 
>the
>quadratic formula for you. I originally wrote it in winders and compiled it
>with Borland C/C++ Builder 4.0 with no problems. Then I brought it over to
>my Linux machine and gcc returns this error:
>
>/tmp/ccv8wX5M.o: In function 'main':
>/tmp/ccv8wX5M.o(.text+0xc7): undefined reference to 'sqrt'
>/tmp/ccv8wX5M.o(.text+0x134): undefined reference to 'sqrt'
>collect2: ld returned 1 exit status
>
>I got one of my CS friends to look at this, he has many years of C behind
>him. He tried compiling this simple program on 2 different flavors of UNIX,
>but it never worked, even simple programs with just one, easy reference to
>any, not just sqrt(), of the math.h calls (ie. sin etc.). Can someone tell
>me how in the world you use math.h on the *INX's? BTW, the varibles being
>sqrt'ed were tried as doubles and floats, but nothing worked. HELP, please.
>Thanks for your time.
>Payne
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Reply via email to