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.