TListBox *setting = new TListBox (GridLayout1); setting->Items->LoadFromFile(GetHomePath()+"settings.txt"); if (EventInfo.GestureID == sgiLeft) { //ошибка в этой строке GridLayout3->Position->X=GridLayout3->Position->X-StrToInt(setting->ItemByIndex(0)->Text); } if (EventInfo.GestureID == sgiRight) { //ошибка в этой строке GridLayout3->Position->X=GridLayout3->Position->X+StrToInt(setting->ItemByIndex(0)->Text); } 

When compiling for win64, everything works correctly. When compiling for Android, the error crashes:

 [bccaarm Error] TabbedTemplate.cpp(635): use of overloaded operator '==' is ambiguous (with operand types 'const Fmx::Types::TGestureID' and 'const System::Int8' (aka 'const signed char')) sysmac.h(1167): candidate function sysmac.h(1167): candidate function sysmac.h(1167): candidate function TabbedTemplate.cpp(635): built-in candidate operator==(int, int) 

What is the problem? How to fix?

  • What does the full error message look like? - AnT
  • one
    [bccaarm Error] TabbedTemplate.cpp (635): use of overloaded operator 'const Fmx :: Types :: TGestureID' and 'const System :: Int8' (aka 'const signed char' )) sysmac.h (1167): candidate function sysmac.h (1167): candidate function sysmac.h (1167): candidate function TabbedTemplate.cpp (635): built-in candidate = = (int, int) And further "last line type" with different types of variables - Maxim Voitenko
  • And from the candidate function in the list is named only "built-in candidate operator == (int, int)" and no one else? - AnT
  • In general, for some reason, the if statement gives an error. but through switch everything turned out. strange! - Maxim Voitenko

1 answer 1

If if not compiled, and switch compiled, then we can only assume that TGestureID is a certain enum for which the comparison operator with some extraneous integer type is overloaded

 enum TGestureID { A, B, C }; bool operator ==(TGestureID id, long i) { return (long) id == i; } 

In this situation, we get

 int main() { TGestureID id = A; const signed char s = 0; switch (id) // Все в порядке { case s:; } if (id == s) // Ошибка: неоднозначная перегрузка оператора `==` ; } 

Here you can make == compile either through

  if ((int) id == s) 

either through

  if (id == (TGestureID) s) 

But to judge whether this applies to your situation is difficult, because you don’t provide almost any information, and the information that you provide is gnawed beyond recognition for some reason.