John
John

Reputation: 539

Error: ambiguous call to overloaded function

float App::fresnelReflectTerm(float etaPos, float etaNeg, float cos_theta_i)
{
float theta_i;
theta_i = acos(cos_theta_i);
    ...

This generates an "ambiguous call to overloaded function error" and says that there are four options:

float acos(float fValue)
double acos(double _X)
float acos(float _X)
long double acos(long double _X)    

I suspect that the problem is that the first and third both take a float arg and return a float value. But can anyone give me a hint about how I might determine (I'm using Visual Studio) where those four functions came from, so that I can eliminate the duplication, for instance? Or perhaps just give me a hint on how to get around this problem.

Upvotes: 2

Views: 2083

Answers (2)

bakaDev
bakaDev

Reputation: 367

You can press F12 on that function.

Update

Based on comments from the OP, the problem was due to a definition of acos being brought in from G3D::. Using std::acos as opposed to acos will remove the ambiguity.

Upvotes: 2

Matt
Matt

Reputation: 6050

You can enable the file listing compiler option in VS studio, so you will know which files are include during compiling, see this msdn article.

Upvotes: 1

Related Questions