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

Delphi Compiler Error

E2065 Unsatisfied forward or external declaration ‘%s’

Reason for the Error & Solution

This error message appears when you have a forward or external declaration of a procedure or function, or a declaration of a method in a class or object type, and you don’t define the procedure, function or method anywhere.

Maybe the definition is really missing, or maybe its name is just misspelled.

Note that a declaration of a procedure or function in the interface section of a unit is equivalent to a forward declaration – you have to supply the implementation (the body of the procedure or function) in the implementation section.

Similarly, the declaration of a method in a class or object type is equivalent to a forward declaration.

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.

The definition of Sum in the above example has an easy-to-spot typo.

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.

The solution: make sure the definitions of your procedures, functions and methods are all there, and spelled correctly.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...