Home Why am I getting E2029 Declaration expected but 'FINALIZATION' found
Reply: 1

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

Gary Walker
1#
Gary Walker Published in 2018-01-11 15:43:26Z

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.
Gary Walker
2#
Gary Walker Reply to 2018-01-11 15:44:44Z

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.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.256935 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO