Expand To Show Full Article
Delphi Error - E2074 Label declared and referenced, but not set '%s' - Developer Publish

Delphi Error – E2074 Label declared and referenced, but not set ‘%s’

Delphi Compiler Error

E2074 Label declared and referenced, but not set ‘%s’

Reason for the Error & Solution

You declared and used a label in your program, but the label definition was not encountered in the source code.

  program Produce;

    procedure Labeled;
    label 10;
    begin
      goto 10;
    end;

  begin
  end.

Label 10 is declared and used in the procedure ‘Labeled’, but the compiler never finds a definition of the label.

  program Produce;

    procedure Labeled;
    label 10;
    begin
      goto 10;
      10 
    end;

  begin
  end.

The simple solution is to ensure that a declared and used label has a definition, in the same scope, in your program.