Cbuilder XE Ambiguity in function IntToStr

The compiler reports ambiguity between 2 functions IntToStr(int) and IntToStr(_int64)
Who is Participating?
Kent OlsenData Warehouse Architect / DBACommented:
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?

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.