Cry about...
Delphi Troubleshooting


Unable to locate file "XXXX"


Symptom:

Within the Delphi development environment, right clicking a function and selecting 'Find Declaration' causes the following error message to appear:

Unable to locate file "XXXX"

where "XXXX" is typically one of "windows.pas", "system.pas", "sysutils.pas", e.g.

Unable to locate file "Windows.pas"

or

Unable to locate file "sysutils.pas"

Cause:

The editor is trying to locate the definition of the function requested, however the source file containing the definition is either missing or the editor is looking for it in the wrong place.

Possible Remedies:

  • The file "Windows.pas" is located in "$(DELPHI)\Source\Rtl\Win". This may be missing from the browsing path. To check, go to Tools, Environment options. Select the "Library" tab, and ensure that "$(DELPHI)\Source\Rtl\Win" is included somewhere in the browsing path. Add it if necessary, ensuring that there is a semi colon (';') between the existing path and the new entry.
  • The files "system.pas" and "sysutils.pas" are missing from the Delphi 6 (Personal Edition) distribution (they should be located in $(DELPHI)\Source\Sys). Delphi 6 Update 2 (available for download from www.borland.com) should contain these files (but didn't seem to when I tried it) but this may be deliberate for the Personal edition.
  • This error is also caused by having a path duplicated in the Delphi Library list. One path perhaps formed using the Environment Variable approach, and one entered by an install program perhaps which is a full-path reference to the same directory.

    Tip kindly contributed by Mike Dixon

  • It can also occur if there are too many entries in the search, I think more than 99. That one was quite the feat of tracking down!

    Tip kindly contributed by Mike Dixon


These notes are believed to be correct for Delphi 6, but may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.