Delphi – E2065 Unsatisfied forward or external declaration ‘%s’

Delphi Error

E2065 Unsatisfied forward or external declaration ‘%s’

Problem

When you have a forward or external declaration of a procedure or function in a class or object type, or a declaration of a method in a class or object type, and you don’t specify the procedure, function, or method anywhere, this error message displays.

Perhaps the definition is truly lacking, or perhaps the term is simply misspelt.

Note that declaring a procedure or function in the interface section of a unit is the same as declaring it forward; you must provide the implementation (the method or function’s body) in the implementation section.

A forward declaration is also similar to a method declaration in a class or object type.

program Produce;

type
  TMyClass = class
  constructor Create;
  end;

function Sum(const a: array of Double): Double; forward;

function Summ(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

In the example above, there is an obvious error in the definition of Sum.

program Solve;

type
  TMyClass = class
  constructor Create;
  end;

constructor TMyClass.Create;
begin
end;

function Sum(const a: array of Double): Double; forward;

function Sum(const a: array of Double): Double;
var
  i: Integer;
begin
  Result := 0.0;
  for i:= 0 to High(a) do
  Result := Result + a[i];
end;

begin
end.

You can fix this error by making sure that your procedures, functions, and methods have all of their definitions and are spelled correctly.