简体   繁体   中英

IDE expecting file to be in different location

I have a component package in Delphi XE2 version 16.0.4429.46931, both a run-time and design-time package together. This package has existed for over a year, and the file/folder structure has always been the same. I keep all the units in a dedicated Source folder from the root, and the actual packages in a Packages folder in the same root. So the packages are found in \\Root\\Packages\\ and units are found in \\Root\\Source\\ .

Today, after building the run-time package, I was going through the hints and warnings. One of the warnings was this:

[DCC Warning] Inno.TimeChart.pas(1): W1025 Unsupported language feature: 'class constructor'

The warning its self is not what worries me. The problem is when I double-click this warning, I get an error message from the IDE:

IDE错误消息

The one thing which I immediately noticed was that it is not looking in the Source folder, but rather directly in the Packages folder. Somehow, the IDE is expecting that the unit be in the same location as the package. Ever since I created the package over a year ago, I have never changed any of the library paths, locations of files, or structure of the package.

The file does exist, but in a different place than it appears to be looking. The file has never been saved in the folder with the projects, and in fact nothing other than the package projects themselves have ever been saved in the Packages folder. This all resides in the Source folder, but the IDE seems to think otherwise.

Why would the IDE think this file is in a different folder? All the other hints and warnings related to the same unit work just fine when I double-click them, but not this one.

EDIT

I've created a new test package to troubleshoot this issue.

Root\TestPackage.dpr
Root\Source\TestPackageUnit.pas

The specific piece of code which is causing this compiler warning is in this class:

type
  TMyComponent = class(TComponent)
  strict private
    class constructor Create;
  end;

When I compile, using Process Monitor, I see the IDE is searching in 30+ different places for this file (of course failing), it looks like it's searching in every library path, rather than in the one place the package says it's at.

Things I've Tried

  1. Verified there is no difference between these paths between the DPR and DPROJ files
  2. Installed all the latest updates and the IDE FixPack (actually gave me new problems)
  3. Monitored file's access with Process Monitor
    1. Filters: process name equals BDS.exe ; Path ends with TestPackageUnit.pas
    2. Result: "NAME NOT FOUND" --> Desired Access: Generic Read Disposition: Open Options: Synchronous IO Non-Alert, Non-Directory File Attributes: N ShareMode: Read, Write AllocationSize: n/a
  4. Tried with designtime-only, runtime-only, and designtime/runtime combined
  5. Tried with component registered and unregistered
  6. Tried with directory in library path and not in library path
  7. Removed about 20 unnecessary entries from library path to make it shorter
  8. Moved directory to top of library path
  9. Verified there is no DOF file associated with project (That I think is from older versions)
  10. Restarted IDE and computer number of times
  11. Cleaned up compiled and temporary files from project, including BPL and DCU files
  12. Changed strict private to just private and even public

I do run into such problems when the delphi search path list is too long. I could always help myself in moving the relevant directories more to the front, ie up in the list.

Check that the file has not been added to the project file (dpr or dpk). Project - View Source will display the file.

If this isn't the case, try searching all the files in your project for the file name and see what turns up.

Found this on another website:

There is another QC that is probably linked to your problem. http://qc.embarcadero.com/wc/qcmain.aspx?d=87693

Go to Project Options -> Delphi Compiler -> Output C/C++ and under C/C++ output file generation select Generate DCUs only.

Dalija Prasnikar

Source: http://codeverge.com/embarcadero.delphi.general

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM