Error 1 Error C2668 Ambiguous Call To Overloaded Function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss ambiguous call to overloaded function pow the workings and policies of this site About Us Learn more about
Ambiguous Call To Overloaded Function C++
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow ambiguous call to overloaded function sqrt Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each
Ambiguous Call To Overloaded Function Template
other. Join them; it only takes a minute: Sign up C++ compiler error: ambiguous call to overloaded function up vote 13 down vote favorite string aux; int maxy,auxx=0; cin>>aux; maxy= (int)sqrt(aux.size()); I'm geting: 1> error C2668: 'sqrt' : ambiguous call to overloaded function 1> could be 'long double sqrt(long double)' 1> or 'float sqrt(float)' 1> or 'double sqrt(double)' error c2668 pow Why? c++ share|improve this question edited Jun 3 '11 at 22:09 pickypg 14k24164 asked Jun 3 '11 at 22:06 andandandand 7,27640127221 add a comment| 4 Answers 4 active oldest votes up vote 26 down vote accepted string::size() returns size_t, and sqrt doesn't accept it in any of its versions. So the compiler has to cast, and cannot choose to what - all of them are OK. You have to put explicit cast: maxy = (int)sqrt((double)aux.size()); share|improve this answer answered Jun 3 '11 at 22:09 littleadv 16.8k2041 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). Subscribed! Success! Please click the link in the confirmation email to activate your subscription. up vote 9 down vote The problem is that in C++, there are three functions named sqrt - one taking in a float, one taking a double, and one taking a long double. When you try calling sqrt(aux.size()); The compiler tries to dete
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow
Ceil Ambiguous Call To Overloaded Function
the company Business Learn more about hiring developers or posting ads with us Stack
Abs Ambiguous Call To Overloaded Function
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of how can a call to overloaded function be ambiguous 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ambiguous call to overloaded function 'pow' up vote 4 down vote favorite I'm having some problems runnning the http://stackoverflow.com/questions/6233132/c-compiler-error-ambiguous-call-to-overloaded-function following code. I got this: error C2668: 'pow' : ambiguous call to overloaded function. I've tried to manually cast the arguments to the appropiate type using static_cast, however I think I get some pointer errors?! The program should convert a number from base 16 to base 10. #define _CRT_SECURE_NO_WARNINGS #include
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ error C2668:ambiguous call to overloaded function Rate this: Please Sign up or sign in to vote. See more: C++ I have written a sample code where I am getting the error: vc_study.cpp(44) : error C2668: 'xyz::xyz' : ambiguous call to overloaded function vc_study.cpp(18): could be 'xyz::xyz(int,int)' vc_study.cpp(14): or 'xyz::xyz(void)' 1> while trying to match the argument list '(void)' \vc_study.cpp(54) : error C2668: 'xyz::xyz' : ambiguous call to overloaded function vc_study.cpp(18): could be 'xyz::xyz(int,int)' vc_study.cpp(14): or 'xyz::xyz(void)' 1> while trying to match the arg