croceldon
croceldon

Reputation: 4595

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

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.

Upvotes: 1

Views: 10421

Answers (3)

Dai ty
Dai ty

Reputation: 11

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!!!!

Upvotes: 1

Vegar
Vegar

Reputation: 12898

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

Upvotes: 5

Mason Wheeler
Mason Wheeler

Reputation: 84540

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.

Upvotes: 1

Related Questions