this post is about dealing with “ambiguous call to overloaded function” type of errors in microsoft visual studio 2008.you are welcome to add solutions to similar type of errors in comment section.
case 1 : use of math .h header to make use of log function
suppose the code fragment is similar to this one.
t=log((count[leaf]+1))/log((2));
hereĀ after debugging the error you get is given below.
“error C2668: ‘log’: ambiguous call to overloaded function”
Solution:
instead of math.h header you need to use
#include <cmath>
The log function in cmath is defined as:
double log( double )
long double log( long double )
float log( float )
so you will have to typecast above codefragment as
t=log(double(count[leaf]+1))/log(double(2));
3 Comments
Thanks a lot!!!
Thanks
…
Many many thankss