* need help using math.h
@ 1999-10-07 5:39 Bruce Fisher
1999-10-07 6:02 ` Tim Prince
1999-10-31 13:57 ` Bruce Fisher
0 siblings, 2 replies; 6+ messages in thread
From: Bruce Fisher @ 1999-10-07 5:39 UTC (permalink / raw)
To: help-gcc
im writing a program that needs to use the pow function.
i've included math.h but still i get an error when i compile. "undefined
reference to 'pow'.
what am i doing wrong?
here is a piece of the code im using that calls the pow function.
double oper(char symb, double op1, double op2)
{
switch(symb)
{
case '+': return(op1 + op2);
case '-': return(op1 - op2);
case '*': return(op1 * op2);
case '/': return(op1 / op2);
case '$': return(pow(op1,op2));
default: printf("\nillegal operation");
}
}
any help would be greatly appreciated
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: need help using math.h
1999-10-07 5:39 need help using math.h Bruce Fisher
@ 1999-10-07 6:02 ` Tim Prince
1999-10-07 23:25 ` Tim Prince
1999-10-31 13:57 ` Tim Prince
1999-10-31 13:57 ` Bruce Fisher
1 sibling, 2 replies; 6+ messages in thread
From: Tim Prince @ 1999-10-07 6:02 UTC (permalink / raw)
To: help-gcc
>undefined
>reference to 'pow'.
>
>what am i doing wrong?
You have failed to use either an in-line option, if available, or to include
the -lm to request linking of the math library, in accordance with tradition of
15 years standing, long enough to be in your text books.
Tim Prince
tprince@computer.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: need help using math.h
1999-10-07 6:02 ` Tim Prince
@ 1999-10-07 23:25 ` Tim Prince
1999-10-31 13:57 ` Tim Prince
1999-10-31 13:57 ` Tim Prince
1 sibling, 1 reply; 6+ messages in thread
From: Tim Prince @ 1999-10-07 23:25 UTC (permalink / raw)
To: help-gcc
Make that a tradition of at least 23 years, that -lm is required to make sure
that math functions are available when linking. And I'm not advocating the
in-line pow() even though it takes care of this little omission.
Tim Prince
tprince@computer.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: need help using math.h
1999-10-07 6:02 ` Tim Prince
1999-10-07 23:25 ` Tim Prince
@ 1999-10-31 13:57 ` Tim Prince
1 sibling, 0 replies; 6+ messages in thread
From: Tim Prince @ 1999-10-31 13:57 UTC (permalink / raw)
To: help-gcc
>undefined
>reference to 'pow'.
>
>what am i doing wrong?
You have failed to use either an in-line option, if available, or to include
the -lm to request linking of the math library, in accordance with tradition of
15 years standing, long enough to be in your text books.
Tim Prince
tprince@computer.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: need help using math.h
1999-10-07 23:25 ` Tim Prince
@ 1999-10-31 13:57 ` Tim Prince
0 siblings, 0 replies; 6+ messages in thread
From: Tim Prince @ 1999-10-31 13:57 UTC (permalink / raw)
To: help-gcc
Make that a tradition of at least 23 years, that -lm is required to make sure
that math functions are available when linking. And I'm not advocating the
in-line pow() even though it takes care of this little omission.
Tim Prince
tprince@computer.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* need help using math.h
1999-10-07 5:39 need help using math.h Bruce Fisher
1999-10-07 6:02 ` Tim Prince
@ 1999-10-31 13:57 ` Bruce Fisher
1 sibling, 0 replies; 6+ messages in thread
From: Bruce Fisher @ 1999-10-31 13:57 UTC (permalink / raw)
To: help-gcc
im writing a program that needs to use the pow function.
i've included math.h but still i get an error when i compile. "undefined
reference to 'pow'.
what am i doing wrong?
here is a piece of the code im using that calls the pow function.
double oper(char symb, double op1, double op2)
{
switch(symb)
{
case '+': return(op1 + op2);
case '-': return(op1 - op2);
case '*': return(op1 * op2);
case '/': return(op1 / op2);
case '$': return(pow(op1,op2));
default: printf("\nillegal operation");
}
}
any help would be greatly appreciated
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-10-31 13:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-07 5:39 need help using math.h Bruce Fisher
1999-10-07 6:02 ` Tim Prince
1999-10-07 23:25 ` Tim Prince
1999-10-31 13:57 ` Tim Prince
1999-10-31 13:57 ` Tim Prince
1999-10-31 13:57 ` Bruce Fisher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).