Home > Enterprise >  Delphi 2007 - Compile errors on updating Indy from 10.5.1.1 to 10.6.2.0
Delphi 2007 - Compile errors on updating Indy from 10.5.1.1 to 10.6.2.0

Time:01-21

I recently updated the stock Indy that installs with Delphi 2007 (I think it is 10.5.1.1) with 10.6.2.0, which I downloaded from GitHub.

I'm now getting a compile error:

EAttachmentFileNotFound.IfFalse (FileExists (parActualAttachmentFileID), 'File '   parActualAttachmentFileID   ' not found.') ;    
Error: E2003 Undeclared identifier: 'IfFalse'

The fragment is from my own code but I'm pretty sure that bit came from something I found probably on S/Overflow.

I received a couple of other errors also:

SMTPClient.AuthType           := atDefault ;    
Error: E2003 Undeclared identifier: 'atDefault' 

and

SMTPClient.OnWork             := EmailThread.EmailOnWork ;
Error: E2010 Incompatible types: 'Int64' and 'Integer'

but the first is a member that was renamed, and the second a data type that was changed. While these were a simple enough workaround, I'm left wondering

  • whether there was ever a "breaking changes" document generated.
  • maybe I accidentally somehow got the wrong source set.

CodePudding user response:

EAttachmentFileNotFound is not a standard Indy exception, so it must be coming from your own code, or another 3rd party library.

Delphi 2007 was released almost 16 years ago. A lot has changed in Indy during that time. In fact, I think the changes you mention were actually made prior to, or maybe around, the release of Delphi 2007 (as they already existed in Indy's code in early 2008).

For instance:

  • in EIdException, the If(True|False) methods were removed (I don't know when exactly that change happened). In which case, you will have to use your own if and raise expressions now, eg:

    if not FileExists(parActualAttachmentFileID) then
      raise EAttachmentFileNotFound.Create('File '   parActualAttachmentFileID   ' not found.');
    
  • in TIdComponent, the AWorkCount/Max parameters of the OnWork... events were changed from Integer to Int64 in 2006 (see OnWork Events changed to 64 bit on Indy's blog).

  • in TIdSMTP, the atDefault value was renamed to satDefault (again, I don't know exactly when this change was made).

So, you need to update your code accordingly.

I'm left wondering whether there was ever a "breaking changes" document generated.

No such document was ever created, no. However, changes that affect user code are typically announced on Indy's blog, under the Changelog category.

  • Related