Delphi Error – E2036 Variable required

Delphi Compiler Error

E2036 Variable required

Reason for the Error & Solution

This error message occurs when you try to take the address of an expression or a constant.

program Produce;
var
  I: Integer;
  PI: ^Integer;
begin
  PI := Addr(1);
end.

A constant like 1 does not have a memory address, so you cannot apply the operator or the Addr standard function to it.

program Solve;
var
  I: Integer;
  PI: ^Integer;
begin
  PI := Addr(I);
end.

You need to make sure you take the address of variable.

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...