Re: Real C++ compile problems
Re: Real C++ compile problems
- Subject: Re: Real C++ compile problems
- From: "\"Clark S. Cox ?\"" <email@hidden>
- Date: Sat, 26 Jun 2004 11:24:00 -0400
On Saturday, June 26, 2004, at 09:24AM, email@hidden <email@hidden> wrote:
>Thank you all for your initial help with Xcode and seeing the flaws in my code. Sometimes when you write it yourself your blind to your own mistakes.
>
>But THIS time Im having a confusing error. My program compiles and runs fine in unix, whereas in Xcode my errors are:
>
>square.h:32: error: call of overloaded `sqrt(int)' is ambiguous
>math.h:302: error: candidates are: double sqrt(double)
>cmath:461: error: float std::sqrt(float)
>cmath:465: error: long double std::sqrt(long double)
>
>It looks like its having trouble with my sqrt calls. I dont know why its saying the call is overloaded.
> Also I didnt write the math.h or cmath.h programs, so I hope theres no errors there.
The error is telling you that sqrt() accepts one of three types: float, double or long double. When you pass it an int (as you do with sqrt(2) ), the compiler doesn't know which one to call (int could be promoted to any of those types). To solve this, pass one of the three types that it is asking for. For instance, change "sqrt(2)" to "sqrt(2.0)".
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.