0

I'll be trying to call a function from elsewhere in the program and I get the "Undeclared identifier" error. Here's an example:

  if GameParams.ClassicMode and not GameParams.GameResult.gSuccess then
  begin
  if not TGameBaseScreen.TryLoadReplay then
    begin
    fReplayManager.Clear(true);
    end;
  end;

I'm working in a unit called LemGame.pas. In the above case, TGameBaseScreen is underlined as Undefined identifier.

I'm almost certain that this method/class (not sure exactly what it is tbh) belongs to a unit called GameBaseScreenCommon.pas, but when I type GameBaseScreenCommon in the list of uses at the top of LemGame.pas, I get a circular reference error. So, LemGame and GameBaseScreenCommon are apparently already connected.

There is a big list of types, classes and procedures at the top of LemGame. I'm pretty sure I need to be referencing TGameBaseScreen here, but I don't know exactly where or as what. i.e. class, function, procedure, variable, type, etc.

Complete beginner, as I'm sure you can tell. If you do reply, I likely won't know exactly what you mean at first. I've already watched a bunch of videos about the way that Delphi (and other languages) are structured, in theory. The problems always come when you're actually working on something and it's more complicated than printing "Hello World" or doing some sort of number calculation.

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Willicious
  • 13
  • 2
  • 3
    Searching [both tags at once](https://stackoverflow.com/questions/tagged/circular-reference+delphi) will show you other Q&As to this topic. Thumb of rule is: you don't have to stuff everything in your `uses` list in the `interface` section - you can also have `uses` in the `implementation` section - as such it's not circular anymore - see [Difference between adding a unit to the interface or the implementation section](https://stackoverflow.com/q/528472/4299358). – AmigoJack Mar 01 '23 at 14:16

0 Answers0