• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Real C++ compile problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Real C++ compile problems
      • From: Heath Raftery <email@hidden>
  • Prev by Date: Real C++ compile problems
  • Next by Date: Project references
  • Previous by thread: Re: Real C++ compile problems
  • Next by thread: Re: Real C++ compile problems
  • Index(es):
    • Date
    • Thread