简体   繁体   English

德尔福:失踪的Dcu

[英]Delphi: Missing Dcu

[DCC Fatal Error] Unit1.pas(7): F1026 File not found: 'MyBitBtn.dcu' [DCC致命错误] Unit1.pas(7):F1026找不到文件:'MyBitBtn.dcu'

Unit1 is a VCL Form for test purposes. Unit1是用于测试目的的VCL表单。

I have installed a design time package which contains a custom component that derived from TBitBtn. 我安装了一个设计时包,其中包含一个派生自TBitBtn的自定义组件。 I can load the MyBitBtn in the Delphi IDE, load up the custom images I coded in design time and it seems like it works fine, at least visually. 我可以在Delphi IDE中加载MyBitBtn,加载我在设计时编码的自定义图像,看起来它工作正常,至少在视觉上。 I get the above compile time error when I try to compile the test project. 当我尝试编译测试项目时,我得到上面的编译时错误。

I have a package group that has one design time package and one run time package. 我有一个包组,有一个设计时包和一个运行时包。 Design time package registers the component and Runtime package inherits the TBitBtn and has the custom code in it. 设计时包注册组件,Runtime包继承TBitBtn并在其中包含自定义代码。 The design time package contains the RunTime DCP file in the requires section . 设计时包在requires部分包含RunTime DCP文件

The moment I insert the custom button on the test form, IDE creates the USES clause for MyBitBtn file. 当我在测试表单上插入自定义按钮时,IDE会为MyBitBtn文件创建USES子句。 And that file apparently can't be found. 那个文件显然无法找到。 Shouldn't that be part of the package installed? 不应该是安装包的一部分吗?

Most probable you did not set 'Unit output directory' option in your runtime package, so package .dcu's are not available; 最有可能的是你没有在运行时包中设置'Unit output directory'选项,因此包.dcu不可用; I usually set it to $(BDSCOMMONDIR)\\Dcp and have no problems. 我通常把它设置为$(BDSCOMMONDIR)\\Dcp并没有问题。

Generally, the .dcu's of a runtime package should be available via global IDE library path if you want your package to be available to any project: 通常,如果您希望包可用于任何项目,则应通过全局IDE库路径提供运行时包的.dcu:

lib路径 .

You should either use one of the existing paths or add your own. 您应该使用现有路径之一或添加自己的路径。

The design part works, but for run time, the compiler must be able to find the dcu. 设计部分可以工作,但是对于运行时,编译器必须能够找到dcu。 You can do that either... 你可以这样做......

  1. By adding the dcu folder to the library path of the IDE. 通过将dcu文件夹添加到IDE的库路径。
  2. By adding the dcu folder to the search path of the project. 通过将dcu文件夹添加到项目的搜索路径中。
  3. Or by adding the dcu explicitly to the project. 或者通过将dcu明确添加到项目中。

I would choose the first option. 我会选择第一个选项。 Since it's an installed component, you would want it to be available for any project, so setting the library path makes the most sense. 由于它是一个已安装的组件,因此您希望它可用于任何项目,因此设置库路径最有意义。

define the path where this dcu is stored in system environment. 定义此dcu存储在系统环境中的路径。 And dont forget to include it in Delphi env paths. 并且不要忘记将它包含在Delphi env路径中。

Go to ZEOS files, open packages, choose your version(DelphiXE10/Delphi7 ...) then go to the Win 32 file, open it and open Debug folder. 转到ZEOS文件,打开包,选择你的版本(DelphiXE10 / Delphi7 ...)然后转到Win 32文件,打开它并打开Debug文件夹。 Copy every thing, go to Program Files, Embarcadero, Studio, 17.0, lib, Win 32, Debug and paste, do the same in every win32 folder... Hope it helps :) 复制每一件事,转到Program Files,Embarcadero,Studio,17.0,lib,Win 32,Debug和paste,在每个win32文件夹中都这样做...希望有帮助:)

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

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