Book a Demo

Author Topic: Delphi unit identifier, filename mismatch  (Read 6003 times)

sftweng

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Delphi unit identifier, filename mismatch
« on: June 16, 2004, 11:45:33 am »
Assume that I have a class called TMyClass within a package called MyPackage. Having generated source code for the package and using "Auto Generate Files", the source code for TMyClass is written to the file "TMyClass.Pas".

However, the unit declaration within the file is:
"unit uTMyClass" and other classes that use TMyClass have a use list like "uses uTMyClass".

On compile, this results in the error message:
"Unit identifier 'uTMyClass' does not match file name" and the compile fails.

How can I solve this problem? I see no way to change the file name in the "Generate Code" dialog to force the filename to "uTMyClass.pas".

The "u" prefix appears to be hardcoded and I can accept that but the code actually generated should be written to the file whose name is the class name prefixed by the "u" and suffixed by ".pas".

The system I'm working with is quite large and I'm not keen to start over, choosing a filename manually for each generated class.

Suggestions, please?  ???

Alan
Alan

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Delphi unit identifier, filename mismatch
« Reply #1 on: June 16, 2004, 03:28:52 pm »
Hi Alan,

My suggestion is to download build 730 when it is released.   :)  Another user brought it to our attention that the unit name needs to be the same as the file name so I fixed that and it will be released with build 730.

For consistency I think I will also make the auto generate files option add the "u" to the file name.  (Not promised, just considered)

I know this isn't perfect since you'll need to wait a few days at least, but I hope it's something.

Simon

sftweng

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Delphi unit identifier, filename mismatch
« Reply #2 on: June 16, 2004, 04:53:04 pm »
Thanks for the prompt reply and good news that there is a fix in the works. I can probably wait for it unless it takes weeks or months rather than days. :)

Alan
Alan