简体   繁体   中英

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.

You can press F12 on that function.

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.

您可以在VS Studio中启用“文件列表编译器”选项,因此您将知道在编译过程中包括哪些文件,请参阅此msdn 文章

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM