E2050 Statements not allowed in interface part (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

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.