为什么编译器无法在我的包中包含外部 DCU?

发布于 2024-12-28 06:44:14 字数 484 浏览 3 评论 0原文

我有这个错误:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

汹涌人海 2025-01-04 06:44:14

您不能引用不属于软件包一部分的单元,因为软件包需要是一个独立的软件。这意味着包必须包含它使用的所有单元,或者通过其 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

  • include the unit in the package that you are building, or
  • add the package which contains that unit to the requires list of the package you are building.
风筝在阴天搁浅。 2025-01-04 06:44:14

你的问题似乎是

为什么编译器会发出这个错误?

如果您引用单元 A,则需要解析对单元 A 的引用。如果在当前包或 require 子句中的另一个包中找不到它,则编译器根本无法继续。

你还问:

为什么编译器无法在我的包中包含外部 DCU?

您只需在 .dpk 文件的 contains 子句中将该单元添加到包中即可。

Your question seems to be

Why does the compiler emit this error?

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:

Why the compiler cannot include an external DCU in my package?

You can simply add the unit to your package in the contains clause of your .dpk file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文