#include <stdio.h>
#include <math.h>
int
main(void)
{
double e = exp10(10);
printf("%f\n", e);
return 0;
}
I wrote this code to try an isolate a similar error in another program. I've attempted to compile the code with make, and I can't. I've also tried adding the #define _GNU_SOURCE directive recommended in the man entry for exp10. That didn't help.
I would appreciate any help anyone can offer. Thank you.
--
comp.lang.c.moderated - moderation address: cl...@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
exp10 is a GNU extension, not a standard C library function.
Did you add the "#define _GNU_SOURCE" directive *above* the "#include
<math.h>" directive?
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
I'm using LccWin32 and it seems to work without problem.
#include <stdio.h>
#include <math.h>
int main()
{
double e;
double x = 1.877665544;
e = exp10(x);
printf("%f\n",e); /* displays: 75.451094 */
return 0;
}
This sample from Lcc docs.
Many thanks.
Bruce
P.S. Great quote - Sir Arnold, no?
perhaps try: pow( 10, x )
Apparently exp10() is both a GNU extension and an lcc-win32
extension. Both exp10()s probably do the same thing (except that the
lcc-win32 version probably doesn't require _GNU_SOURCE to use it).
Since exp10() is not standard C, presumably lcc-win32 would complain
about the call when invoked in a standard-conforming mode (I think
it's something like "-ansic").
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
>Hi. I repeatedly receive an "implicit declaration of function" error on the line on which I call exp10() in the following code:
>/* A program to understand exponent calls better. */
Maybe because math.h does not declare an exp10 function. In fact,
there is no standard function with that name. If your compiler
provides such a function as an extension, the documentation should
tell you where it is declared or how you activate the extension.
>
>#include <stdio.h>
>#include <math.h>
>
>int
>main(void)
>{
> double e = exp10(10);
> printf("%f\n", e);
> return 0;
>}
>
>I wrote this code to try an isolate a similar error in another program. I've attempted to compile the code with make, and I can't. I've also tried adding the #define _GNU_SOURCE directive recommended in the man entry for exp10. That didn't help.
This appears to be gnu problem. A group that discusses that compiler
may be a better source for you.
>
>I would appreciate any help anyone can offer. Thank you.
--
Remove del for email
In LccWin32, exp10() is declared in math.h.
> --
> comp.lang.c.moderated - moderation address: c...@plethora.net -- you must
> In LccWin32, exp10() is declared in math.h.
You appear to be assuming that this fact were of any relevance to the
discussion at hand. It isn't.