Cbuilder XE Ambiguity in function IntToStr

The compiler reports ambiguity between 2 functions IntToStr(int) and IntToStr(_int64)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:
Hi PB,

C++ Builder has log had issues with this particular item.  It occurs when more than one function (method) is available for the given parameters and the compiler is forced to choose between them.

The error can be produced a couple of ways.  If for instance, the method occurs in two different classes or namespaces.  You can resolve this by selecting the correct underlying class in the function call.

  sys::IntToStr ();



I believe that the error can also be caused when an exact match to the function declaration doesn't exist and the compiler must recast the parameter to match a known function (method).

  IntToStr(int) and IntToStr(_int64)

If the parameter being passed is neither an int nor an __int64, but is a general integer type (e.g., unsigned char) the compiler must choose a method for you.  In this case, simply recasting the parameter to an int or __int64 will invoke the correct method.

Can you post the code and full error message?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
George TokasCommented:
Hello there,
Since I had this problem multiple times...
Anyway you want to convert a number to its string representation for use somewere as I had...
First of all to use the string representation inside a control (TEdit, TLabel or whatever ) just assign it to the Text property without conversion. It usually works...
In any other case depending to what you want to display use IntToStr((unsigned int)value);
unsigned int is just as example. You can use whatever.
Using this way you are type casting the value inside IntToStr() function...

George Tokas.
PruneBottleAuthor Commented:
Many thanks, it worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.