-->

What to do if tgamma() function is not defined?

2019-08-28 00:50发布

问题:

I am trying to use tgamma() from the standard library. When I try to compile, I get the error message:

Call to undefined function tgamma

I have the directive #include <cmath>. I use Embarcadero C++ Builder XE3, which claims to support C++11 standards. What could be my problem, and how to fix it?

回答1:

Boost contains a tgamma function.

#include <boost/math/special_functions/gamma.hpp>
...
double rootPi = boost::math::tgamma<double>(0.5);

Of course, you can always switch to a different compiler, like gcc.