E2251 Ambiguous overloaded call 'CompareText'

delphi package - madRes, madTools, madStrings, ...

E2251 Ambiguous overloaded call 'CompareText'

Postby JanDoggen » Tue Feb 09, 2010 12:59 pm

Hi, my Delphi 2007 refuses to compile because of this error.
My code:
with List do
begin
for i := 0 to Items.Count-1 do
begin
if CompareText(Items[i].Caption, SomeStr) = 0 then
so there's not much I can do there.

The help says:
Based on the current overload list for the specified function, and the programmed invocation, the compiler is unable to determine which version of the procedure should be invoked.

program Produce;

procedure f0(a : integer); overload;
begin
end;

procedure f0(a : integer; b : char = 'A'); overload;
begin
end;

begin
f0(1);
end.
In this example, the default parameter that exists in one of the versions of f0 makes it impossible for the compiler to determine which procedure should actually be called.

Is this what is going on in madStrings and can it be fixed?

Bye
Jan
JanDoggen
 
Posts: 30
Joined: Thu Nov 26, 2009 11:23 am
Location: Netherlands

Postby madshi » Wed Feb 10, 2010 10:51 pm

What type does SomeStr have? Just "string"? In that case simply use "madStrings.CompareText" instead of "CompareText". I think that should fix the problem.
madshi
Site Admin
 
Posts: 9273
Joined: Sun Mar 21, 2004 5:25 pm


Return to madBasic

Who is online

Users browsing this forum: No registered users and 2 guests