HomeDelphiDelphi Error – E2036 Variable required

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

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...