Category: Delphi

Delphi – E2060 Class and interface types only allowed in type section

In a type section of your delphi program, class or interface types must always be stated with an explicit type declaration. They cannot be anonymous, unlike other record kinds. The key reason for this is that you wouldn’t be able to declare the type’s methods otherwise (since there is no type name). Attempting to declare a class type within a variable declaration is incorrect: How…

Delphi – E2009 Incompatible types – ‘%s’

A distinction between the declaration and use of a procedure has been discovered by the compiler. Because the type ‘ProcedureParm0′ expects a’stdcall’ procedure, but ‘WrongConvention’ is declared with the’register’ calling convention, the call to ‘TakesParm0’ will result in an error. Similarly, because the parameter lists do not match, the call to ‘TakesParm1’ will fail. Both of these issues can be solved by ensuring that the…

Delphi – E2018 Record, object or class type required

The compiler was looking for a type name that specified a record, object, or class, but none could be found. In this application, there are two possible causes for the same error. The first is when you use ‘.’ on something that isn’t a record. In the second scenario, a variable of the wrong type is used in a WITH statement. The simple answer to…

Delphi – E2072 Number of elements (%d) differs from declaration (%d)

When you declare a typed constant or initialised variable of array type in your Delphi program but don’t specify the correct amount of items, this error message appears. Although the sample declares a 10-element array, the initialization only provides 9 entries. To make the compiler happy, we just had to provide the missing piece. It can be difficult to tell if you’ve supplied the correct…

Delphi – E2016 Array type required

If you index into an operand that isn’t an array, or if you pass an argument that isn’t an array to an open array parameter, you’ll see this error notice. We attempt to apply an index to a pointer to an integer, which is legal in C but not in Delphi. We must tell the compiler that we want P to point to an array…

Delphi – E2071 This type cannot be initialized 

In Delphi, you can’t declare typed constants or initialised variables of file types (including type Text) or the type Variant since they can’t be initialised. The example attempts to declare an initialised Variant variable, which is forbidden. The solution is to use an assignment statement to initialise a normal variable.

Delphi – E2011 Low bound exceeds high bound

When the low bound of a subrange type is more than the high bound, or the low bound of a case label range is bigger than the high bound, this error message is displayed. Instead of considering the ranges as empty in the preceding example, the compiler throws an error. The reversing of the bounds was most likely unintentional. Make sure the boundaries are stated…

Delphi – E2014 Statement expected, but expression of type ‘%s’ found

Instead of finding a statement, the compiler discovered an expression of the provided type. The compiler was looking for a statement like an IF, WHILE, or REPEAT in this case, but instead encountered the expression (3+4). The result of the expression (3+4) was assigned to the variable ‘a’ as a solution. Another option would have been to remove the objectionable expression from the source code;…

Delphi – E2010 Incompatible types – ‘%s’ and ‘%s’

When the compiler expects two types to be compatible (or similar), but they turn out to be different, this error message appears. In general, deciding how to overcome type incompatibilities requires a close examination of your software. If you get an error message like this: [DCC Error] Project1.dpr(8): E2010 Incompatible types: ‘Integer’ and ‘Extended’ The expected type (Integer) is the first type in this message,…

Delphi – E2065 Unsatisfied forward or external declaration ‘%s’

Delphi Error E2065 Unsatisfied forward or external declaration ‘%s’ Problem When you have a forward or external declaration of a procedure or function in a class or object type, or a declaration of a method in a class or object type, and you don’t specify the procedure, function, or method anywhere, this error message displays. Perhaps the definition is truly lacking, or perhaps the term…