为什么编译器无法在我的包中包含外部 DCU?
我有这个错误:
E2411 包 %s 中的单元 %s 引用单元 %s,但在 任何包裹。打包单元必须仅引用打包单元 (Delphi)
Delphi 帮助非常有帮助,它说:
没有关于此错误或警告的更多信息。
为什么我无法引用不属于包一部分的单元?
更新:
永无止境的故事:将文件放入自己的包中会破坏其他内容:单元 GIFImg 是使用不同版本的 CCR.Exif.Consts.SOutOfResources 编译的 这就是为什么我不想将文件放在自己的包中。
I have this error:
E2411 Unit %s in package %s refers to unit %s which is not found in
any package. Packaged units must refer only to packaged units (Delphi)
Delphi Help is extremely helpful and it says:
No further information is available for this error or warning.
Why I can't refer to a unit that is not part of a package?
UPDATE:
Never-ending story: Putting the file in its own package breaks something else: Unit GIFImg was compiled with a different version of CCR.Exif.Consts.SOutOfResources
This is why I wanted NOT to put the file in its own package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能引用不属于软件包一部分的单元,因为软件包需要是一个独立的软件。这意味着包必须包含它使用的所有单元,或者通过其 require 子句中的包提供它们。
要解决此错误,您可以将该
You can't refer to a unit that is not part of a package because a package needs to be a self-contained piece of software. That means that a package must contain all units it uses or have them available through packages in its requires clause.
To solve this error you can either
你的问题似乎是
如果您引用单元 A,则需要解析对单元 A 的引用。如果在当前包或 require 子句中的另一个包中找不到它,则编译器根本无法继续。
你还问:
您只需在 .dpk 文件的 contains 子句中将该单元添加到包中即可。
Your question seems to be
If you refer to unit A then that reference to unit A needs to be resolved. If it cannot be found in the current package, or another package in the requires clause, then the compiler simply cannot proceed.
You also ask:
You can simply add the unit to your package in the contains clause of your .dpk file.