error C2668: 'sqrt' : ambiguous call
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
dear all sorry to ask so basic question, i am newcomer, when i compiled, if some errors occurred, always show C2668 or C2783, what is C2669 and so forth? the following question is what i mentioned in title. thanks a lot.
gentleguy
Which sqrt are you referring to? The CRT function sqrt() has four overloads...you need to provide enough info about the types of the return value and the passed argument so the compiler knows which one to use.
int n = sqrt(3); // error C2668: 'sqrt' : ambiguous call to overloaded function
double d = sqrt(2.0); // no error - return value and passed argument are doubles
int n = (int)sqrt((double)3); // no error (except loss of precision converting double to int)
Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: