Gary Walker
Gary Walker

Reputation: 9134

Why am I getting E2029 Declaration expected but 'FINALIZATION' found

I don't see any syntax error, my code compiles clean without the finalization section. Here is the last few lines of the unit.

function boolAsTF(b:boolean): string; inline;
begin
  if b then result := 'T' else result := 'F';
end;

finalization
  SyncMgr.Free;
end.

Upvotes: 1

Views: 1967

Answers (1)

Gary Walker
Gary Walker

Reputation: 9134

If you use a finalization section, you must also use an initialization section.

I accidentally hit this again, and remember this being hard to figure out the first time. So I thought I would document it here to help the next guy.

Kudos to MartynA who answered in a comment about as fast I I did when I knew I was going to answer it immediately.

Upvotes: 7

Related Questions