E2036 Variable required (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

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.