Delphi抛出错误“未声明的标识符TForm”,为什么?

huangapple go评论80阅读模式
英文:

Delphi throwing error "undeclared identifier TForm", why?

问题

我已经面对这个错误大约30分钟了,但找不到解决方案。有人可以帮我吗?

Delphi抛出错误“未声明的标识符TForm”,为什么?

Delphi抛出错误“未声明的标识符TForm”,为什么?

我尝试在谷歌上寻找解决方案,但找不到一个。

英文:

I have been facing this error for like 30 mins and I can't find a solution. Can someone please help me?

Delphi抛出错误“未声明的标识符TForm”,为什么?

Delphi抛出错误“未声明的标识符TForm”,为什么?

I tried to google for a solution, but I couldn't find one.

答案1

得分: 1

TForm 在 VCL 的 Forms 单元中声明,这个单元在你的单元的 interface 部分的 uses 子句中缺失。这就是为什么你会收到关于 TForm 未声明的错误消息。

修复这个问题应该也会解决关于 Perform()Close() 的错误。

关于其他的 "未声明标识符" 错误:

  • clWindowGraphics 单元中声明。

  • FormatDateTime()Now()DateToStr()SysUtils 单元中声明。

  • MessageDlg()Dialogs 单元中声明。

确保这些单元也在你的 uses 子句中,最好放在你的单元的 implementation 部分,而不是 interface 部分。

英文:

TForm is declared in the VCL's Forms unit, which is missing in the uses clause of your unit's interface section. That is why you are getting an error about TForm being undeclared.

Fixing that should solve the errors about Perform() and Close(), too.

Regarding the other "undeclared identifier" errors:

  • clWindow is declared in the Graphics unit.

  • FormatDateTime(), Now(), and DateToStr() are declared in the SysUtils unit.

  • MessageDlg() is declared in the Dialogs unit.

Make sure those units are in your uses clause as well, preferably in your unit's implementation section rather than in its interface section.

huangapple
  • 本文由 发表于 2023年6月9日 04:44:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76435569.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定