简体   繁体   English

IDE期望文件位于不同的位置

[英]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. 我在Delphi XE2版本16.0.4429.46931中有一个组件包,它们都是运行时和设计时包。 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. 我将所有单元保存在根目录下的专用Source文件夹中,以及同一根目录下Packages文件夹中的实际包。 So the packages are found in \\Root\\Packages\\ and units are found in \\Root\\Source\\ . 所以这些包可以在\\Root\\Packages\\中找到,单位可以在\\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收到一条错误消息:

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. 我立即注意到的一件事是它不是在Source文件夹中查找,而是直接在Packages文件夹中查找。 Somehow, the IDE is expecting that the unit be in the same location as the package. 不知何故,IDE期望该单元与包位于同一位置。 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. 该文件从未保存在包含项目的文件夹中,实际上除了包项目本身之外没有其他任何内容保存在Packages文件夹中。 This all resides in the Source folder, but the IDE seems to think otherwise. 这一切都存在于Source文件夹中,但IDE似乎不这么认为。

Why would the IDE think this file is in a different folder? 为什么IDE会认为此文件位于不同的文件夹中? 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. 当我使用Process Monitor进行编译时,我看到IDE正在30多个不同的位置搜索此文件(当然是失败的),它看起来像是在每个库路径中搜索,而不是在包中所说的那个位置。

Things I've Tried 我试过的事情

  1. Verified there is no difference between these paths between the DPR and DPROJ files 已验证DPRDPROJ文件之间的这些路径没有区别
  2. Installed all the latest updates and the IDE FixPack (actually gave me new problems) 安装了所有最新的更新和IDE FixPack(实际上给了我新的问题)
  3. Monitored file's access with Process Monitor 使用Process Monitor监视文件的访问权限
    1. Filters: process name equals BDS.exe ; 过滤器:进程名称等于BDS.exe ; Path ends with TestPackageUnit.pas 路径以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 结果:“NAME NOT FOUND” - >所需访问:通用读取处置:打开选项:同步IO非警报,非目录文件属性:N ShareMode:读取,写入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 从库路径中删除了大约20个不必要的条目以使其更短
  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) 已验证没有与项目相关联的DOF文件(我认为是旧版本)
  10. Restarted IDE and computer number of times 重新启动IDE和计算机次数
  11. Cleaned up compiled and temporary files from project, including BPL and DCU files 从项目中清除编译和临时文件,包括BPL和DCU文件
  12. Changed strict private to just private and even public strict private改为private甚至public

I do run into such problems when the delphi search path list is too long. 当delphi搜索路径列表太长时,我确实遇到了这样的问题。 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). 检查文件是否尚未添加到项目文件(dpr或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. 还有另一个QC可能与您的问题有关。 http://qc.embarcadero.com/wc/qcmain.aspx?d=87693 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. 转到项目选项 - > Delphi编译器 - >输出C / C ++并在C / C ++输出文件生成下选择仅生成DCU。

Dalija Prasnikar Dalija Prasnikar

Source: http://codeverge.com/embarcadero.delphi.general 资料来源: http//codeverge.com/embarcadero.delphi.general

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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