Im trying to use tgamma function in c++ 10.It's running on a 32-bit machine. I've included , but still getting the error "identifier tgamma is undefined ". what could be the reason?
Asked
Active
Viewed 1,177 times
-2
-
1tgamma or tagmma ? In the later case, that's a typo. – SirDarius Dec 10 '14 at 14:14
-
sorry, you're right. tgamma. – NavidAmin Dec 10 '14 at 14:17
-
Did you enable the c++11 standard? – eerorika Dec 10 '14 at 14:18
-
i guess not.how should I do this? – NavidAmin Dec 10 '14 at 14:19
-
@NavidAmin you should consult your compilers documentation (and you'll need a compiler that does support c++11). Here's a related question for one compiler: http://stackoverflow.com/questions/10363646/compiling-c11-with-g – eerorika Dec 10 '14 at 14:20
-
What do you mean by *it*? C++11 is a standard which specifies the c++ language and the standard library. – eerorika Dec 10 '14 at 14:24
-
sorry but I dont understand why wouldn't it just run on c++10? – NavidAmin Dec 10 '14 at 14:24
-
I'm using visual studio 2010 as the compiler – NavidAmin Dec 10 '14 at 14:26
-
1There is no such thing as c++10. The standard before c++11 was c++03. It doesn't compile on an earlier standard because `tgamma` wasn't a part of the standard library before that. Evidently, your compiler does not support it. – eerorika Dec 10 '14 at 14:30
2 Answers
1
The reason why you cannot use tgamma
is because your compiler doesn't support the standard in which it was introduced. You'll need to use a compiler / standard library that does support c++11 or use another implementation of tgamma
as advised in an answer to in a similar question What to do if tgamma() function is not defined? which Resource kindly linked for you.
-2
math.h is C. Try this instead:
#include <cmath>

Resource
- 524
- 4
- 16
-
Have you checked for typo as in comment above - I know you're using tgamma, but have you actually typed tagmma? – Resource Dec 10 '14 at 14:19
-
-
Check out this other answer: http://stackoverflow.com/questions/16114928/what-to-do-if-tgamma-function-is-not-defined – Resource Dec 10 '14 at 14:29
-
Info for downvoters - the original question specifically included math.h. – Resource Mar 15 '16 at 15:48