E2050 Statements not allowed in interface part (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

The interface part of a unit can only contain declarations, not statements.

Move the bodies of procedures to the implementation part.


unit Produce;

interface

procedure MyProc;
begin                (*<-- Error message here*)
end;

implementation

begin
end.

We got carried away and gave MyProc a body right in the interface section.


unit Solve;

interface

procedure MyProc;

implementation

procedure MyProc;
begin
end;

begin
end.

We need move the body to the implementation section - then it's fine.