Delphi Error – E2029 %s expected but %s found

Delphi Compiler Error

E2029 %s expected but %s found

Reason for the Error & Solution

This error message appears for syntax errors. There is probably a typo in the source, or something was left out. When the error occurs at the beginning of a line, the actual error is often on the previous line.

program Produce;
var
  I: Integer
begin               (*<-- Error message here: ';' expected but 'BEGIN' found*)
end.

After the type Integer, the compiler expects to find a semicolon to terminate the variable declaration. It does not find the semicolon on the current line, so it reads on and finds the ‘begin’ keyword at the start of the next line. At this point it finally knows something is wrong…

program Solve;
var
  I: Integer;       (*Semicolon was missing*)
begin
end.

In this case, just the semicolon was missing – a frequent case in practice. In general, have a close look at the line where the error message appears, and the line above it to find out whether something is missing or misspelled.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...