2
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.

5
  • What includes are you using in this project? Math.h and GenericMathTemplateLibrary? Commented Feb 19, 2014 at 22:49
  • I would start with theta_i = acos((float)cos_theta_i); just to see if that would fake the compiler out, if that got me nowhere fall back on theta_i = (float)acos((double)cos_theta_i); Commented Feb 19, 2014 at 22:50
  • Thanks. For now, I already discovered Tim's idea (the first one, too -- it didn't work), so I'm off and running. Commented Feb 19, 2014 at 22:52
  • As for "what includes are you using?", that's hard to answer: it uses a big library which has about a thousand includes, and I don't have the heart to look through every one, which is why I was hoping VS might be able to tell me. :) Commented Feb 19, 2014 at 22:53
  • In visual studio, go to view->output. Go to the "Error List" you've been looking at and double click the error you mentioned. Now look at the output pane, and it should show the full and complete text of the error message. Doubleclick any line with a filename and it will take you to the exact line of code with thte function(s) in question Commented Feb 19, 2014 at 23:03

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

@John so what was the root problem?
The root problem was the two functions with signatures float acos(float). It turns out that one of them was G3D::acos, a function in the library I was using; once I put on the G3D::, the compiler was able to distinguish. I actually wanted the other one, and still don't know how to get it, but I can manage with what I've got.
@John ummm, can't you just use std::acos?
@Shafik: I'll bet that I could, except I had no idea that was allowed. (I'm an occasional C++ programmer at best, alas.) As usual, I've learned tons by asking a simple question. Thanks!
@John let me know if that works using std:acos for you if it does that should be edited into the answer as a solution.
1

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.

1 Comment

Thanks. I'll file that away for later use, when I'm sure it'll come up.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.