Posts

Showing posts with the label Ambiguous overloaded call to StrPas function Delphi

E2251 Ambiguous overloaded call to '%s' Delphi error

While porting our legacy project from old Delphi version to new Delphi version like from Delphi 7 to Delphi XE5, we faced above error frequently as we have used StrPas / StrPos / StrLen / TextToFloat function calls. And we found several cases and several reasons for cause of this error. Here I will explain why we get this error and what is the solution of this error. Some of following error we faced. E2251 Ambiguous overloaded call to 'Pos' E2251 Ambiguous overloaded call to 'StrPas' E2251 Ambiguous overloaded call to 'StrLen' E2251 Ambiguous overloaded call to 'TextToFloat' Why we get this error and what is the solution? Following are possible reasons of occurring this error in latest Delphi versions code. Case 1 If more than one overloaded version of a function exists in a unit and we are passing wrong arguments to the function call then this error will show. For example. We have different versions of StrPas function in  SysUtils.pa...