Prevent Circular unit reference

How do I prevent Circular unit reference to 'MyUnitU' ?
crystyanAsked:
Who is Participating?
 
atul_parmarConnect With a Mentor Commented:
move either units from interface section to implementation section.
e.g.

interface
uses MyUnitU -->>> Move from here

implementation
uses MyUnitU  ->>> to here
0
 
crystyanAuthor Commented:
then how do I declare a variable that is defined in MyUnitU ?
0
 
atul_parmarCommented:
Moving a unit from interface section to implementation section doesn't affect any other code. you can define /use variables the same way.

Can you clarify what exactly you want to do?
0
 
crystyanAuthor Commented:
I have the main unit, then I`m creating a class where I want to declare a variable of a type that is defined in the main unit. or let`s say use a constant from the main unit.
0
 
atul_parmarCommented:
unit MainUnit

const
  MyConst = 1000;


unit MySubUnit

interface
  procedure MyProc;

implementation
procedure MyProc;
MyVar : Integer;
begin
  MyVar := MyConst;
 
end;
 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.