dear dipankar,
maybe a redundant reply this, still read on:
i've been working for aome time now on both linux, unix, etc etc
(RHL v6.x, 7.x ...) on different platforms,
i dont know whether they use the same compiler or not
(for code accepted by one is rrejected by other)
yet this is the only similarity you are ever gonna find among them.

ALWAYS USE THE -lm switch whenever you are using math.h fns.
ex:
gcc -lm filename.c -o outfile

I have had errors, I dont know why, rather strange output
when i DID USE the -lm switch but didn't write the
#include<math.h>
on top of the code!!Some explanation is reqd !!!!!!!

Hope this helps,
Suman.
BEC.Shibpur.


From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [ilug-cal] math.h
Date: Sun, 28 Sep 2003 22:53:01 -0600

Dear Friends
Can anyone tell me about any reported bug
in GCC math header?
Even a very simple code with a reference to <math.h> is
failing regularly.

Here is the super-intelligent code-let, lifted
directly from C Complete Reference by Schildt,
4th Ed, page 409:


#include <math.h> #include <stdio.h> int main (void) { double x = 10.0, y = 0.0; do { printf("%f\n", pow(x,y)); y++; } while (y < 11.0); return 0; }

Compiling this with gcc both version 3.2.2 in Slack or
3.3 in SuSE is giving the same message. Like this:

/tmp/ccmcLWjH.o(.text+0x3f): In function `main': home/dd/works/c/garbage/tenpow.c:8: undefined reference to `pow'


This same thing is happening with 'sqrt' or cube or anything that invokes math.h Is there any known trick?

dipankar das

--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3

_________________________________________________________________
Answer simple questions. Win a free honeymoon. http://server1.msn.co.in/sp03/shaadi/index.asp Sail into the sunset!



-- To unsubscribe, send mail to [EMAIL PROTECTED] with the body "unsubscribe ilug-cal" and an empty subject line. FAQ: http://www.ilug-cal.org/node.php?id=3

Reply via email to