Delphi 2009 - How to fix 'undeclared identifiers' that are identified

江枫思渺然 提交于 2019-12-11 12:33:08

问题


I have several custom components in my uses list of a unit. For some reason, D2009 is saying that it cannot resolve the unit name. But it seems as if it can find it - the code compiles fine.

How can I have it resolve the unit names at design time though? My Structure window is showing all kinds of 'Undeclared Identifier' errors because the references in the Uses clause are not being found. This makes it difficult to code, and to debug legitimate errors in my code.


回答1:


I think this is something the IDE Fix Pack 2009/2010 can help you with.

RAD Studio 2009 fixes:
  <snip>
  QC #22880: Cannot resolve unit name



回答2:


Error Insight doesn't look for units the same way the normal compiler does, unfortunately, and it can lead strange results like that. Try adding the units that your custom components are in to the DPR. That should fix the problem.




回答3:


suppose you have unit A and unit B, you call some methods in unit B from unit A, you can solve the problem by the following steps.

  1. first of all, clear "uses unit B" in unit A.
  2. add your unit B to current project through "Add to project"
  3. use unit B in unit A through "File/use unit", unit B will be added to unit A under interface, the "Error undeclared identifier" disappear.

That is it!!!!



来源:https://stackoverflow.com/questions/1460101/delphi-2009-how-to-fix-undeclared-identifiers-that-are-identified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!