App fails to compile with "There is no overloaded version of 'CreateRes' that can be called with these arguments" in idGlobal.pas

Giganews Newsgroups
Subject: App fails to compile with "There is no overloaded version of 'CreateRes' that can be called with these arguments" in idGlobal.pas
Posted by:  Ross McMillan (nospam@gmail.com)
Date: Tue, 16 Jun 2009

I have just tried to recompile an app under D2006 that was previously
compiling under D2005.  When I did a build, the compile failed in
idGlobal.pas with "There is no overloaded version of 'CreateRes' that can be
called with these arguments'.  There are several of these and also for
symbol "CreateResFmt".

I did a make instead from the IDE and the compile was successful.  I have
since been messing about with search paths and make doesn't work either now.

I have another app which compiles fine, builds or makes.  AFAICT the search
paths are identical.

This is the routine that gets the compile errors (idGlobal.pas line 1500):

  function TIdTextEncoding.GetBytes(const AChars: TIdChars; ACharIndex,
ACharCount: Integer;
    var VBytes: TIdBytes; AByteIndex: Integer): Integer;
  begin
    if (AChars = nil) and (ACharCount <> 0) then
      raise Exception.CreateRes(@RSInvalidSourceArray);
    if (VBytes = nil) and (ACharCount <> 0) then
      raise Exception.CreateRes(@RSInvalidDestinationArray);
    if ACharIndex < 0 then
      raise Exception.CreateResFmt(@RSCharIndexOutOfBounds, [ACharIndex]);
    if ACharCount < 0 then
      raise Exception.CreateResFmt(@RSInvalidCharCount, [ACharCount]);
    if (Length(AChars) - ACharIndex) < ACharCount then
      raise Exception.CreateResFmt(@RSInvalidCharCount, [ACharCount]);
    if (AByteIndex < 0) or (AByteIndex > Length(VBytes)) then
      raise Exception.CreateResFmt(@RSInvalidDestinationIndex,
[AByteIndex]);

    Result := GetBytes(@AChars[ACharIndex], ACharCount, @VBytes[AByteIndex],
Length(VBytes));
  end ;

CreateRes it would seem is defined in Sysutils.pas:

  constructor Exception.CreateRes(Ident: Integer);
  begin
    FMessage := LoadStr(Ident);
  end;

  constructor Exception.CreateRes(ResStringRec: PResStringRec);
  begin
    FMessage := LoadResString(ResStringRec);
  end;

Which should be fine and generate no error.  I can only conclude that it is
finding an alternative declaration of CreateRes before the one in SysUtils,
but I dunno where..  If control-click on the call the CreateRes in
idGlobal.pas in the IDE, it follows to SysUtils.pas in

  C:\Program Files\Borland\BDS\4.0\source\Win32\rtl\sys\SysUtils.pas.

I can find 2 copies of SysUtils.dcu, one in

    C:\Program Files\Borland\BDS\4.0\lib.

and one in

    C:\Program Files\Borland\BDS\4.0\lib\debug

Niether has been touched, suggesting they are immune from a build.

Running D2006, Indy 10 snapshot from 19 Jan, 2009.

I'm confused, and my app is broke (at least, one of them is).  Can anyone
please shed some light?

TIA,
Ross

Replies