Error Messages

This chapter lists the possible error messages you can get from Delphi. The error messages are grouped into two categories, compiler errors and run-time errors.

Compiler error messages

Whenever possible, the compiler will display additional diagnostic information in the form of an identifier or a file name. For example,

Error 15: File not found (TEST.DCU)

When an error is detected, Delphi automatically loads the source file and places the cursor at the error. The command-line compiler displays the error message and number and places the cursor at the point in the source line where the error occurred. Note, however, that some errors are not detected until a little later in the source text. For example, a type mismatch in an assignment statement cannot be detected until the entire expression after the := has been evaluated. In such cases, look for the error to the left of or above the cursor.

Out of memory

This error occurs when the compiler has run out of memory. Try these possible solutions:

  • Increase the amount of available memory in Windows by closing other

    Windows applications or by increasing the swap file size.

  • Set the Link Buffer option to Disk on the Linker page of the

    Options|Project dialog box.

  • If you are using the command-line compiler, use the /L option to

    place the link buffer on disk.

If none of these suggestions help, your program or unit might be too large to compile in the amount of memory available; you might have to break it into two or more smaller units.

Identifier expected

An identifier was expected at this point.

You may be trying to redeclare a reserved word or standard directive as a variable.

Unknown identifier

This identifier has not been declared, or it may not be visible within the current scope.

Duplicate identifier

Within the current scope, the identifier you are declaring already represents a program's name, a constant, a variable, a type, a procedure or a function.

Syntax error

An illegal character was found in the source text.

You may have omitted the quotes around a string constant.

Error in real constant

The syntax of your real-type constant is invalid. Check to make sure that the assigned value is within the range of a real type. For more information, see Chapter 3.

Note Whole real numbers outside the maximum integer range must be followed by a decimal point and a zero, like this:

12345678912.0

Error in integer constant

The syntax of your integer-type constant is invalid. Check to make sure that the assigned value is within the range of a integer type. For more information, see Chapter 3.

Note Whole real numbers outside the maximum integer range must be followed by a decimal point and a zero, like this:

12345678912.0

String constant exceeds line

You have probably omitted the ending quote in a string constant or your quoted string runs past the line limit of 127 characters. Note that string constants must be declared on a single line.

Unexpected end of file

The most likely causes of this error message are as follows:

  • Your source file ends before the final end of the main statement

    part. The begins and ends are probably unbalanced.

  • An Include file ends in the middle of a statement part. (Every

    statement part must be entirely contained in one file.)

  • You did not close a comment.

Line too long

The maximum source-code line length is 127 characters.

Type identifier expected

The identifier which you are declaring does not denote a type. For more information, “Identifiers” on page 5.

Too many open files

You have exceeded the maximum number of open files. Your CONFIG.SYS file does not include a FILES=xx entry, or the entry specifies too few files.

Increase the number of FILES or close some open files.

Invalid file name

The file name is invalid or specifies a nonexistent path.

File not found

The file could not be found in the current directory or in any of the search directories that apply to this type of file.

Disk full

The disk on which you are compiling this project is out of space. You must delete some files or use a different disk.

Note that the symbolic information used by Turbo Debugger and the Browser can be quite large. If you are not debugging or browsing your files, you can turn these options off to save disk space.

Invalid compiler directive

One of the following applies:

  • The compiler directive letter is unknown.

  • One of the compiler directive parameters is invalid.

  • You are using a global compiler directive in the body of the

    source-code module.

For more information on compiler directives, see Appendix B.

Too many files

There are too many files involved in the compilation of the program or unit.

Try to reduce the number of files by merging Include files, by merging unit files, or by making the file names shorter. Alternately, you can move all the files into one directory and make it the current directory at compile time.

Undefined type in pointer definition

The type was referenced in a pointer-type declaration or a class reference, but never declared in that same block. The referenced type must be declared in the same type block as the pointer or class reference definition. For more information on pointer types, see page 21.

Variable identifier expected

The identifier does not denote a variable. For more information on identifiers, see page 5.

Error in type

This symbol cannot start a type definition.

Structure too large

The maximum allowable size of a structured type is 65520 bytes. In addition, the maximum array size is 65520. Multiply the size of the base type with the number of array elements to obtains the actual size of the array. To manage larger data structures, use TList objects or pointers.

Set base type out of range

The base type of a set must be a subrange between 0 and 255, or an enumerated type with no more than 256 possible values. For more information on set-type ranges, “Set types” on page20.

File components cannot be files or objects

The component type of a file type cannot be any of the following:

  • an object type

  • a file type

  • a file of any structured type that includes a file-type component.

Invalid string length

The declared maximum length of a string must be between 1 and 255. For more information on strings, see “String types” on page 17.

Type mismatch

This error occurs due to one of the following:

  • Incompatible types of the variable and expression in an assignment

    statement.

  • Incompatible types of the actual and formal parameter in a call to a

    procedure or function.

  • An expression type that is incompatible with the index type in array

    indexing.

  • Incompatible operand types in an expression.

  • Your typecast is incorrect.

For more information, see “Type Compatibility” on page 25.

Invalid subrange base type

Only ordinal types are valid base types. For a listing on the Object Pascal ordinal types, see page 12.

Lower bound greater than upper bound

The declaration of a subrange type must specify a lower bound less than the upper bound.

Ordinal type expected

Real types, string types, structured types, and pointer types are not allowed here. For a listing on the Object Pascal ordinal types, see page 12.

Integer constant expected

Only an integer constant is allowed here. For more information on constants, see Chapter 2.

Constant expected

Only a constant is allowed here. For more information on constants, see Chapter 2.

Integer or real constant expected

Only a numeric constant is allowed here. For more information on constants, see Chapter 2.

Pointer type identifier expected

The identifier does not denote a pointer type. For more information on pointer types, see “Pointer Types” on page 21.

Invalid function result type

File types are not valid function result types. For more information, see page 74.

Label identifier expected

The identifier does not denote a label. For more information about labels, see page 6.

BEGIN expected

A BEGIN was expected here, or there is an error in the block structure of the unit or program.

END expected

An END was expected here, or there is an error in the block structure of the unit or program.

Integer expression expected

The expression must be of an Integer type. For more information on integer types page 12.

Ordinal expression expected

The expression must be of an ordinal type. For more information on ordinal types, see page 12.

Boolean expression expected

The expression must be of type Boolean. For more information on Boolean expressions, see page 45.

The compiler can also generate this error if you forget to include an operator in the conditional expression of an if statement.

Operand types do not match operator

The operator cannot be applied to operands of this type; for example, 'A' div '2'.

Error in expression

This symbol cannot participate in an expression in the way it is written. You may have forgotten to write an operator between two operands.

Illegal assignment

Files and untyped variables cannot be assigned values (you must typecast untyped variables to be able to assign values to them).

A function identifier can only be assigned values within the statement part of the function.

Field identifier expected

The identifier does not denote a field in the record variable. For more information on record types, see page 19.

Object file too large

Delphi cannot link in .OBJ files larger than 64K.

Undefined external

The external procedure or function does not have a matching PUBLIC definition in an object file.

Make sure you have specified all object files in $L filename directives, and checked the spelling of the procedure or function identifier in the .ASM file.

Invalid object file record

The .OBJ file contains an invalid object record; make sure the file is an .OBJ file.

There are many reasons why the compiler might generate this error message; however, all the reasons relate to an object file that does not conform to the Delphi object-file requirements. For example, Delphi does not support linking 32-bit flat memory model object files.

Code segment too large

The maximum code size of a program or unit is 65520 bytes.

  • If you are compiling a program, move some procedures or functions

    into a unit.

  • If you are compiling a unit, break it into two or more units.

Data segment too large

The maximum size of a program's data segment is 65520 bytes, including data declared by the units in the program. Note that in Windows programs, both the stack and the local heap "live" in the data segment.

If you need more global data than this, declare larger structures as pointers, and allocate them dynamically using the New procedure.

Note that old model objects (as supported by Borland Pascal 7) store their virtual method tables in the data segment. The new model classes do not. Also, PChar string constants are stored in the data segment. Pascal string constants are not.

If you are using the old model objects, try using the new method classes declaration to reduce the virtual methods used in your program. In addition, try moving PChar string constants into a string table resource.

DO expected

The reserved word DO does not appear where it should.

Invalid PUBLIC definition

Here are some possible sources of this error:

  • Two or more PUBLIC directives in assembly language define the

    same identifier.

  • The .OBJ file defines PUBLIC symbols that do not reside in the

    CODE segment.

Invalid EXTRN definition

Here are some possible sources of this error:

  • The identifier was referred to through an EXTRN directive in

    assembly language, but it is not declared in the unit, nor in the interface part of any of the used units.

  • The identifier denotes an absolute variable.

  • The identifier denotes an inline procedure or function.

Too many EXTRN definitions

Delphi cannot handle .OBJ files with more than 256 EXTRN definitions per object file.

OF expected

The reserved word OF does not appear where it should in the case statement.

INTERFACE expected

The reserved word INTERFACE does not appear where it should; the reserved word INTERFACE is missing or declarations appear before the INTERFACE reserved word.

Invalid relocatable reference

A relocatable reference is usually a pointer to a procedure or function or another type of reference to the code segment.

Here are some possible sources of this error:

  • The .OBJ file contains data and relocatable references in segments

    other than CODE. For example, you may be attempting to declare initialized variables in the DATA segment.

  • The .OBJ file contains byte-sized references to relocatable symbols.

    This error occurs if you use the HIGH and LOW operators with relocatable symbols, or if you refer to relocatable symbols in DB directives.

  • An operand refers to a relocatable symbol that was not defined in

    the CODE

segment or in the DATA segment.

  • An operand refers to an EXTRN procedure or function with an

    offset; for example:

CALL SortProc+8

THEN expected

The reserved word THEN does not appear where it should.

TO or DOWNTO expected

The reserved word TO or DOWNTO does not appear in the for loop.

Undefined FORWARD

Here are some possible sources of this error:

  • The procedure or function was declared in the interface part of a

    unit, but its body never occurred in the implementation part.

  • The procedure or function was declared forward but its definition

    was never found.

Invalid typecast

Here are some possible sources of this error:

  • In a variable typecast, the sizes of the variable reference and the

    destination type differ.

  • You are attempting to typecast an expression where only a variable

    reference is allowed.

  • For more information on variable typecasting, see page 34.

Division by zero

You are attempting to divide using a constant expression that evaluates to zero. The compiler can generate this error only when you use a constant expression as the divisor of a divide operator, and that constant expression evaluates to zero.

Invalid file type

The file-handling procedure does not support the given file's type.

For example, you might have made a call to Readln with a typed file or Seek with a text file.

Cannot read or write variables of this type
Reading:

Read and Readln can input these variables:

  • character

  • integer

  • real

  • string

Writing:

Write and Writeln can output these variables:

  • character

  • integer

  • real

  • string

  • Boolean

Pointer variable expected

This variable must be of a pointer type. For more information on pointer types, see page 21.

String variable expected

This variable must be of a string type. For more information about string types, see page 17.

String expression expected

This expression must be of a string type. For more information about string types, see page 17.

Circular unit reference

Two units reference each other in their interface parts. Move the cross reference of at least one of the units into the implementation section of that unit (rearrange your uses clauses so that at least one of the circular references occurs in the implementation part of the unit). Note that it is legal for two units to use each other in their implementation parts.

Unit name mismatch

The name of the disk file does not match the name declared inside that unit. Check the spelling of the unit name.

Unit version mismatch

A unit used by this project was compiled with an earlier version of the compiler. Make sure the source file for the specified unit is on the compiler search path, then use Compile|Build All to automatically recompile the units that have changed.

If you don't have the source file for the offending DCU unit, contact the author of the unit for an update.

Internal stack overflow

The compiler's internal stack is exhausted due to too many levels of nested statements.

You must rearrange your code to remove some levels of nesting.

For example, move the inner levels of nested statements into a separate procedure.

Unit file format error

The .DCU file is invalid; make sure it is a .DCU file.

The .DCU file may have been created with a previous version of Delphi. In this case, you must recompile the corresponding .PAS file to create a new .DCU file.

For more information about units, see Chapter 11.

IMPLEMENTATION expected

The reserved word IMPLEMENTATION must appear between the interface part and the actual procedure definitions.

Constant and case types don't match

The type of the case constant is incompatible with the case statement's selector expression. For more information on type compatibility, see page 25.

Record or object variable expected

This variable must be of a record or object type. For more information, see page 17.

Constant out of range

You are trying to do one of the following:

  • Index an array with an out-of-range constant.

  • Assign an out-of-range constant to a variable.

  • Pass an out-of-range constant as a parameter to a procedure or

    function.

File variable expected

This variable must be of a file type. For more information on file types, see page 21.

Pointer expression expected

This expression must be of a pointer type. For more information on pointer types, page 21.

Integer or real expression expected

This expression must be of an integer or a real type. For more information on integer or real types, see page 11.

Label not within current block

A goto statement cannot reference a label outside the current block. For more information on goto statements, see page 56.

Label already defined

The label already marks a statement. You have declared a label and then are trying to reassign the label identifier within the same block. For more information on labels, see page 6.

Undefined label in preceding statement part

The label was declared and referenced in a statement part, but never defined. You must define some action to occur when control proceeds to this label. For more information on labels, see page 6.

Invalid @ argument

Valid arguments are variable references and procedure or function identifiers. For more information on the @ operator, see page 49.

UNIT expected

The reserved word unit should appear in the header for the module. If you have any other reference, such as program or library, you must replace it with unit. If you are trying to compile this unit as a .DLL you must replace program with library in the project file.

";" expected

A semicolon does not appear where it should. The line above the highlighted line is missing a semicolon. All Object Pascal statements are separated by a semicolon.

":" expected

A colon does not appear where it should. The offending line is missing a colon. When you are defining an identifier you must separate it from its type using a colon. For more information on type declarations, see page 11.

"," expected

A comma does not appear where it should.

"(" expected

An opening parenthesis is missing from the selected line.

This error might indicate that the compiler considers the identifier to the left of the insertion point a type identifier. In this case, the compiler is looking for an opening parenthesis to make a typecast expression.

")" expected

A closing parenthesis is missing from the selected line.

"=" expected

An equal sign is missing from the selected line. The equals sign is a relational operator used to test equality.

":=" expected

An assignment operator is missing from the selected line. The assignment operator is used to assign values to variables or properties.

For more information on assignment statements, see page 55.

"[" or "(." expected

A left bracket is missing from the selected line.

"]" or ".)" expected

A right bracket is missing from the selected line.

"." expected

A period is missing from the selected line. This indicates that a type is being used as a variable or that the name of the program itself overrides an important identifier from another unit.

".." expected

A subrange is missing from the declaration for a subrange type. For more information on subrange types, see page 15.

Too many variables
Global

The total size of the global variables declared within a program or unit cannot exceed 64K.

Local

The total size of the local variables declared within a procedure or function cannot exceed 64K.

Invalid FOR control variable

The FOR statement control variable must be a simple variable defined in the declaration part of the current subroutine.

Integer variable expected

This variable must be of an integer type. For more information on integers, see page 12.

File types are not allowed here

A typed constant cannot be of a file type. For more information on typed constants, see page 35.

String length mismatch

The length of the string constant does not match the number of components in the character array. For more information on string constants, see page 37.

Invalid ordering of fields

The fields of a record or object type constant must be written in the order of declaration. For more information on record types see page 19.

String constant expected

A string constant is expected to appear in the selected statement. For more information on string constants, see page 37.

Integer or real variable expected

This variable must be of an integer or real type. For more information on numeric types, see page 11.

Ordinal variable expected

This variable must be of an ordinal type. For more information on ordinal types, see page 12.

INLINE error

The < operator is not allowed in conjunction with relocatable references to variables. Such references are always word-sized.

For more information on relocatable expressions, see page 198.

Character expression expected

This expression must be of a character type. For more information on character types, see page 14.

Too many relocation items

The size of the relocation table in the .EXE file exceeds 64K, which is the limit supported by the Windows executable format.

If you encounter this error, your program is simply too big for the linker to handle. It is also probably too big for Windows to execute. Each executable segment has its own relocation table. Too many relocations in one code segment can cause this error.

If you use the old object model supported by Borland Pascal 7, virtual method tables could cause this error to occur in the data segment, since the virtual method tables are 100% relocation items. For more information on the new class model supported by Delphi, see Chapter 9.

One solution is to split the program into a "main" part that executes two or more "subprogram" parts.

Overflow in arithmetic operation

The result of the preceding arithmetic operation is not in the Longint range

(-2147483648..2147483647)

Correct the operation or use real-type values instead of integer-type values.

This is an error that the compiler catches at compile time; the expression in question must be a constant expression, and not an expression that contains variables that are determined at run-time.

No enclosing FOR, WHILE, or REPEAT statement

The Break and Continue standard procedures cannot be used outside a for, while, or repeat statement.

Debug information table overflow

This error indicates that an overflow occurred while generating Turbo Debugger symbol information in the .EXE file.

To avoid this error, turn debug information off (using a {$D-} compiler directive) in one or more of your units or by unchecking Debug Information on the Compiler page of the Project Options dialog box.

CASE constant out of range

For integer-type case statements, the constants must be within the range

  • 32768..65535. For more information on case statements, see page 58.
Error in statement

This symbol cannot start a statement.

This error, for example, can be caused by unbalanced begin and end statements. As an example, the following segment of code generates this error on the else statement:

if ( <expression> )

begin

<statement>

<statement>

else

<statement>

Cannot call an interrupt procedure

You cannot directly call an interrupt procedure.

Duplicate CASE constant

The constant or range is already handled by a previous case statement entry. A case

statement is not allowed to have overlapping constants or ranges.

Must be in 80x87 mode to compile

This construct can only be compiled in the {$N+} state.

Operations on the 80x87 real types (Single, Double, Extended, and Comp) are not allowed in the {$N-} state. Note that {$N+} is on by default.

Target address not found

The Search|Find Error command could not locate a statement that corresponds to the specified address.

The unit containing the target address must have {$D+} debug information enabled for the compiler to locate the statement.

Include files are not allowed here

Every statement part must be entirely contained in one file.

No inherited methods are accessible here

You are using the inherited keyword outside a method, or in a method of an object type that has no ancestor. For more information on inheriting methods or properties, see page 87.

Invalid qualifier

You are trying to do one of the following:

  • Index a variable that is not an array.

  • Specify fields in a variable that is not a record.

  • Dereference a variable that is not a pointer. For more information

    on qualifiers, see page 32.

Invalid variable reference

This construct follows the syntax of a variable reference, but it does not denote a memory location. Some of the possible causes for this error are:

  • You are trying to pass a constant parameter to a variable parameter.

  • You are calling a pointer function, but you are not dereferencing

    the result.

  • You are trying to assign a value (or values) to a portion of a

    property that is of type record. When properties are of type record, you must assign values to the entire record; you cannot assign values to individual fields of the record. (although you can read individual field values of a record). For example, if you have a property P that is of type TPoint, the following statement will generate this error:

P.X := 50;

Instead, you must assign values to all the fields of the record property:

XX := 50;

YY := 25;

P := Point (XX, YY);

For more information on variable references, see page 31.

Too many symbols

The program or unit declares more than 64K of symbols.

If you are compiling with {$D+}, try turning it off. You can also split the unit by moving some declaration into a separate unit.

Note This will disable debugging information from the module and will be unable to use the debugger with that module.

Statement part too large

Delphi limits the size of a statement part to about 24K of compiled machine code.

If you encounter this error, move sections of the statement part into one or more procedures.

For more information on statements, see Chapter 6.

Undefined class in preceding declaration

You declared a forward reference to a class, but the actual declaration of the class does not appear in the same type block (make sure you have not inserted a const block between the two blocks). For example,

type

MyClass = class;

is a forward reference.

For more information on deriving classes, see Chapter 9.

Files must be var parameters

You are attempting to declare a file-type value parameter. File-type parameters must be var parameters.

For more information on var parameters, see page 77.

Too many conditional symbols

There is not enough room to define further conditional symbols.

Try to eliminate some symbols, or shorten some of the symbolic names. For more information on conditional symbols, see page 242.

Misplaced conditional directive

The compiler encountered an {$ELSE} or {$ENDIF} directive without a matching

{$IFDEF}, {$IFNDEF}, or {$IFOPT} directive.

For more information on these directives, see page 242.

ENDIF directive missing

The source file ended within a conditional compilation construct.

There must be an equal number of **{$IFxxx}**s and {$ENDIF} in a source file.

Error in initial conditional defines

The initial conditional symbols specified on the Directories/Conditionals page of the Project Options dialog box (or in a /D directive) are invalid.

The compiler expects zero or more identifiers separated by blanks, commas, or semicolons.

Header does not match previous definition

The procedure or function header specified in an interface part or FORWARD

declaration does not match this header.

Too many PUBLIC definitions

The .OBJ file contains more PUBLIC definitions than Delphi's linker can handle. Attempt to reduce the number of PUBLIC definitions, for example by breaking the

.OBJ file into two or more .OBJ files.

Cannot evaluate this expression

You are attempting to use a non-supported feature in a constant expression or debug expression.

For example, you might be attempting to use the Sin function in a const declaration, or attempting to call a user-defined function in a debug expression.

For more information on constant expressions, see page 9.

Expression incorrectly terminated

The compiler expects either an operator or the end of the expression (a semicolon) at this point, but found neither.

Invalid format specifier

You are using an invalid debugger format specifier in an expression, or else the numeric argument of a format specifier is out of range.

Unit is missing from uses clause

The statement attempts to make an invalid indirect reference.

For example, you might be using an absolute variable whose base variable is not known in the current module, or using an inline routine that references a variable not known in the current module.

Or, you might have declared a new component type, inheriting from, for example, MyType. MyType has propertied of types defined in a third unit. Your new component's unit does not use that third unit. This results in the generation of this error message on those inherited property types.

In general, if unit A uses a type defined in unit B, and unit B uses a type defined in unit C, unit A must also use unit C to avoid indirect references.

For more information on indirect references, see page 126.

Structured variables are not allowed here

You are attempting to perform a non-supported operation on a structured variable. For example, you might be trying to multiply two records.

For more information on structured variables, see page 17.

Cannot evaluate without System unit

Your DELPHI.DSL library file must contain the System unit for the debugger to be able to evaluate expressions.

Cannot access this symbol

A program's entire set of symbols is available to the debugger (or the Browser) as soon as you have compiled the program with symbolic debug information.

You may be trying to access a symbol that cannot be accessed until you actually run the program.

Invalid floating-point operation

An operation on two real-type values produced an overflow or a division by zero. This is a compiler error that results only from the evaluation of constant expressions.

For more information on floating point operations, see page 44.

Pointer or procedural variable expected

The Assigned standard function requires the argument to be a variable of a pointer or procedural type.

Invalid procedure or function reference

You are attempting to call a procedure in an expression.

A procedure or a function must be compiled in the {$F+} state, and cannot be declared with inline if it is to be assigned to a procedure variable.

File access denied

The file could not be opened or created. The compiler may be trying to write to a read-only file, read from a file that does not exist, or access a file that is already in use. You cannot compile (generate) an .EXE or a .DLL while that module is executing. Terminate the program, then recompile.

Object or class type expected

The identifier does not denote an object or class type. For more information on object types, see Chapter 3.

Local object or class types are not allowed

Object and class types can be defined only in the outermost scope of a program or unit.

Object-type definitions within procedures and functions are not allowed. For more information on object types, see Chapter 3.

VIRTUAL expected

The keyword virtual is missing.

Method identifier expected

The identifier does not denote a method. A method call was expected in the selected statement.

Virtual constructors are not allowed

A constructor method must be static when declared using the object model supported by Borland Pascal 7. For more information on constructors, see page 95.

Note that this construct is of concern only when you use the object model supported by Borland Pascal 7; virtual constructors are supported by the Delphi class model. For more information on the Delphi class model, see Chapter 9.

Constructor identifier expected

This error message is generated when you make a call similar to the following:

New(Type, Constructor);

The second parameter is not a constructor of the given object type. For more information on constructors, see page 95.

Note that this construct is of concern only when you use the object model supported by Borland Pascal 7. For more information on the Delphi class model, see Chapter 9.

Destructor identifier expected

This error message is generated when you make a call similar to the following:

Dispose (objvar, Destructor);

The second parameter is not a destructor of the given object type. For more information in destructors, see page 96.

Fail only allowed within constructors

The Fail standard procedure can be used only within constructors.

Invalid combination of opcode and operands

The assembler opcode does not accept this combination of operands. Possible causes are:

  • There are too many or too few operands for this assembler opcode;

    for example, INC AX,BX or MOV AX.

  • The number of operands is correct, but their types or order do not

    match the opcode; for example, DEC 1, MOV AX,CL or MOV 1,AX.

Memory reference expected

The assembler operand is not a memory reference, which is required here.

You may have forgotten to put square brackets around an index register operand, for example MOV AX,BX+SI instead of MOV AX,[BX+SI].

For more information on memory references, see page 198.

Cannot add or subtract relocatable symbols

The only arithmetic operation that can be performed on a relocatable symbol in an assembler operand is addition or subtraction of a constant.

Variables, procedures, functions, and labels are relocatable symbols. Assuming that Var is variable and Const is a constant, then the instructions MOV AX,Const+Const and MOV AX,Var+Const are valid, but MOV AX,Var+Var is not.

Invalid register combination

Valid index-register combinations are

  • [BX]

  • [BP]

  • [SI]

  • [DI]

  • [BX+SI]

  • [BX+DI]

  • [BP+SI]

  • [BP+DI]

Other index-register combinations, such as [AX], [BP+BX], and [SI+DX], are not allowed.

Local variables are always allocated on the stack and accessed via the BP register. The assembler automatically adds [BP] in references to such variables, so that even though a construct like Local[BX] (where Local is a local variable) appears valid, it is not, since the final operand would become Local[BP+BX].

286/287 instructions are not enabled

This error is generated when you are using a 80286 (or greater) opcode in inline assembly statements. Use the {$G+} compiler directive to enable 286/287 opcodes, but be aware that the resulting code cannot be run on 8086 and 8088 based machines (the default for this directive is on).

Invalid symbol reference

This symbol cannot be accessed in an assembler operand. Possible causes are that you are attempting to:

  • access a standard procedure, a standard function, or the Mem, MemW,

    MemL, Port, or PortW special arrays in an assembler operand.

  • access a string, floating-point, or set constant in an assembler

    operand.

  • access an inline procedure or function in an assembler operand.

  • access the @Result special symbol outside a function.

  • generate a short JMP instruction that jumps to something other than

    a label.

Code generation error

The preceding statement part contains a LOOPNE, LOOPE, LOOP, or JCXZ instruction that cannot reach its target label. These short-jump assembly instructions can jump at the most 127 bytes (or -128 bytes). Reverse the logic of your jump instruction to do an unconditional far jump to the target label, preceded by conditional near jump (reverse logic) over the far jump.

ASM expected

The compiler expects an ASM reserved word at this location. (A procedure or function declared as assembler must start with asm, not begin.

Duplicate dynamic method index

This dynamic method index has already been used by another method. For more information on dynamic methods, see page 92.

Note that this construct is of concern only when you use the object model supported by Borland Pascal 7, since you cannot specify an index for dynamic methods using the class model introduced with Delphi. For more information on the Delphi class model, see Chapter 9.

Duplicate resource identifier

This resource file contains a resource with a name or identifier that has already been used by another resource.

Duplicate or invalid export index

The ordinal number specified in the Index cause is not between 1 and 32767, or has already been used by another exported routine.

Procedure or function identifier expected

The exports clause only allows procedures and functions to be exported.

Cannot export this symbol

A procedure or function cannot be exported unless it was declared with the export directive.

Duplicate export name

The name specified in the name clause has already been used by another exported routine.

Executable file header too large

The size of the header of the .EXE file being generated exceeds the .EXE file format's upper limit of 64K bytes.

You may be importing or exporting too many procedures and functions by name, or you may have too many named resources.

Consider importing or exporting by ordinal numbers instead.

Too many segments

The executable file being generated contains more than 254 segments, which is the upper limit of the DOS protected mode and Windows .EXE file format.

Most likely, the preferred code segment size for the executable file is too small. Specify a larger preferred code segment size using a {$S segsize**}** compiler directive.

READ or WRITE clause expected

The property you are declaring must obtain its values by reading and writing to methods or fields declared in the private part of the class declaration or are inherited from an ancestor.

For more information on declaring properties, see page 102.

Cannot read a write-only property

The property you are attempting to read from is write-only. It has no value to read.

Cannot assign to a read-only property

The property is your assignment statement is read only. It will not accept any values you try to assign.

Cannot exit a FINALLY block

The entire group of statements in a finally block must execute. It is illegal to prematurely break out of a finally block.

For more information on finally blocks, see page 120.

Label and GOTO not at same nesting level

Any label which is being accessed by a goto statement must be within the same block a the goto statement. You cannot jump into another routine.

For more information on goto statements, see page 56.

ON expected

To handle a raised exception within an excepts block you must preface the exception type identifier with the on standard directive. For more information on handling exceptions, see page 115.

Cannot mix class and object types

These types are incompatible. You cannot inherit one type from the other or assign from variables of one to the other. For more information on type compatibility, see page 25.

PROCEDURE or FUNCTION expected

The class method you are trying to declare requires that you follow the class reserved word with either procedure or function. For more information on class methods, see page 110.

Class type identifier expected

The instance of the exception you are trying to handle in your on clause must be a class type. For more information on handling exceptions, see page 115.

Class expression expected

The exception you are trying to raise must evaluate to a class instance. You can only raise exceptions on class instances. For more information on raising exceptions, see page 114.

Instance variable not accessible here

Inside the body of a class procedure or class function, you cannot refer to any instance data, nor can you refer to the self pointer or any fields of the class type.

Invalid method reference

You are trying to access a method of a class without a valid instance of that class. You cannot call non-class methods from within a class method. To solve this problem you must instantiate the class or use a class method. For more information on class methods, see page 110.

Default property must be an array property

You have declared a property to be the default property of a class that is not of type array or without assigning it a value. (You might have forgotten to define a value after the default directive.

Although you can assign a default value to a property of any type, Delphi will only accept default properties that are of type array.

For more information on specifying default properties, see page 104.

Class already has a default property

Each class can only have one default property. You cannot change the default if your ancestor defines a default array property. For more information on specifying default properties, see page 104.

Invalid message handler parameter list

The parameter list you are passing to the message handler does not match the list the message handler was expecting. A message method must have one variable parameter of any type. Any other parameters will cause this message to be generated.

Method does not exist in base class

You can only override methods that exist in an ancestor class. You are trying to override a method that does not exist in the ancestor class. To solve the problem,

remove override from the method declaration and recompile your module (also, be sure you are using the correct spelling of the method you are typing to override.

For more information on overriding methods, see page 93.

Cannot override a static method

Static methods cannot be overridden using the override directive. A method must be dynamic or virtual in order to be overridden. For more information on static methods, see page 90.

Property does not exist in base class

You can only override properties that exist in an ancestor class. You can move an inherited property to a higher visibility level by "redeclaring" the property name with no type information in the descendant. For example:

Public

property MyProp;

end;

Also, when you are redeclaring (promoting) a property from protected to public or published, make sure you match the spelling of the property as it is shown the base class.

Unit has no register procedure

When you are declaring a new component, you must declare and define a Register procedure for the unit. This will tell Delphi what components to add to its component library and which page of the Component palette the components should appear. Note that you will only receive this message when you install the unit into the component library.

Type not supported in expression lists

In an array of const constructor you can only use the following types:

  • float types

  • scalar types

  • pointer types

  • string types

For example, you cannot pass a record to the Format function which uses an array of

const for the second parameter.

For more information on type-variant open-array parameters, see page 82.

Property access method not found

The property you are trying to evaluate is a write only property. You cannot evaluate a property that does not have a read method. For more information on read methods, see page 102.

Expression too complex

The selected expression is too complex for the debugger's expression evaluator. Try breaking the expression into smaller statements. For more information on expressions, see Chapter 5.

Process faulted during evaluation

The expression you are evaluating in the integrated debugger caused a General Protection Fault during its execution.

Exception raised during evaluation

The process which you are evaluating with the integrated debugger threw an exception.

Evaluator already active

You can only have one instance of the debugger's evaluator open at any time.

Property access method removed by smart linker

You are trying to access or evaluate a run-time only property for a class that was not used in the source code. If a run-time only property is not used in the source code, the smart linker removes that property from the compiled code.

If you want to access this property, you must use it in the source code.

RAISE not allowed outside EXCEPT..END block

You can only reraise an exception within a except block. For more information on reraising exceptions, see page 117.

Resource file format error

The given file is not a valid .RES file. Note that bitmap (.BMP) and icon (.ICO) files cannot be linked directly into an executable. They must first be imported into a resource file.

PUBLISHED not allowed in this class

If a class is declared in the {$M–} state, and is not derived from a class that was declared in the {$M+} state, published sections are not allowed in the class. For further details, see "Component Visibility" on page 89, and the description of the $M compiler directive on page 181.

This field cannot be PUBLISHED

Fields defined in a published section must be of a class type. Fields of all other types are restricted to public, protected, and private sections.

This property cannot be PUBLISHED

The property does not meet the requirements of a published property. For further details, see "Published components" on page 89.

Run-time errors

Certain errors at run time cause the program to display an error message and terminate:

Run-time error nnn at xxxx:yyyy

where nnn is the run-time error number, and xxxx:yyyy is the run-time error address (segment and offset).

The run-time errors are divided into four categories: File errors, 1 through 99; I/O errors, 100 through 149; and fatal errors, 200 through 255.

File errors

Invalid function number.

You made a call to a nonexistent DOS function.

File not found.

Reported by Reset, Append, Rename, Rewrite if the filename is invalid, or Erase if the name assigned to the file variable does not specify an existing file.

Path not found.
  • Reported by Reset, Rewrite, Append, Rename, or Erase if

    the nameassigned to the file variable is invalid or specifies a nonexistent subdirectory.

  • Reported by ChDir, MkDir, or RmDir if the path is invalid or

    specifiesa nonexistent subdirectory.

Too many open files.

Reported by Reset, Rewrite, or Append if the program has too many open files. DOS never allows more than 15 open files per process. If you get this error with less than 15 open files, it might indicate that the CONFIG.SYS file does not include a FILES=xx entry or that the entry specifies too few files. Increase the number to some suitable value, such as 20.

File access denied.
  • Reported by Reset or Append if FileMode allows writing and the

    name assigned to the file variable specifies a directory or a read-only file.

  • Reported by Rewrite if the directory is full or if the name

    assigned to the file variable specifies a directory or an existing read-only file.

  • Reported by Rename if the name assigned to the file variable

    specifies a directory or if the new name specifies an existing file.

  • Reported by Erase if the name assigned to the file variable

    specifies a directory or a read-only file.

  • Reported by MkDir if a file with the same name exists in the

    parent directory, if there is no room in the parent directory, or if the path specifies a device.

  • Reported by RmDir if the directory isn't empty, if the path

    doesn't specify a directory, or if the path specifies the root directory.

  • Reported by Read or BlockRead on a typed or untyped file if the

    file is not open for reading.

  • Reported by Write or BlockWrite on a typed or untyped file if

    the file is not open for writing.

Invalid file handle.

This error is reported if an invalid file handle is passed to a DOS system call. It should never occur; if it does, it is an indication that the file variable is somehow trashed.

12 Invalid file access code.

Reported by Reset or Append on a typed or untyped file if the value of FileMode is invalid.

Invalid drive number.

Reported by GetDir or ChDir if the drive number is invalid.

Cannot remove current directory.

Reported by RmDir if the path specifies the current directory.

Cannot rename across drives.

Reported by Rename if both names are not on the same drive.

No more files.

A call to FindFirst or FindNext found no files matching the specified file name and set of attributes.

I/O errors

These errors cause termination if the particular statement was compiled in the {$I+} state. In the {$I-} state, the program continues to execute, and the error is reported by the IOResult function.

Disk read error.

Reported by Read on a typed file if you attempt to read past the end of the file.

Disk write error.

Reported by CloseFile, Write, Writeln, or Flush if the disk becomes full.

File not assigned.

Reported by Reset, Rewrite, Append, Rename, and Erase if the file variable has not been assigned a name through a call to Assign.

File not open.

Reported by CloseFile, Read, Write, Seek, Eof, FilePos, FileSize, Flush, BlockRead, or

BlockWrite if the file is not open.

File not open for input.

Reported by Read, Readln, Eof, Eoln, SeekEof, or SeekEoln on a text file if the file is not open for input.

File not open for output.

Reported by Write and Writeln on a text file if you fail to use the WinCrt unit.

Invalid numeric format.

Reported by Read or Readln if a numeric value read from a text file does not conform to the proper numeric format.

Fatal errors

These errors always immediately terminate the program.

Division by zero.

The program attempted to divide a number by zero during a /, mod, or div

operation.

Range check error.

This error is reported by statements compiled in the {$R+} state when one of the following situations arises:

  • The index expression of an array qualifier was out of range.

  • You attempted to assign an out-of-range value to a variable.

  • You attempted to assign an out-of-range value as a parameter to a

    procedure or function.

Stack OverFlow

There are too many local variables declared in a procedure or function compiled in the {$S+} state.

Increase the size of the stack with the $M compiler directive.

The Stack Overflow error can also be caused by infinite recursion, or by an assembly language procedure that does not maintain the stack properly.

Heap overflow error.

This error is reported by New or GetMem when there is not enough free space in the heap to allocate a block of the requested size.

For a complete discussion of the heap manager, see Chapter 16.

Invalid pointer operation.

This error is reported by Dispose or FreeMem if the pointer is nil or points to a location outside the heap.

Floating point overflow.

A floating-point operation produced a number too large for Delphi or the numeric coprocessor (if any) to handle.

Floating point underflow.

A floating-point operation produced an underflow. This error is only reported if you are using the 8087 numeric coprocessor with a control word that unmasks underflow exceptions. By default, an underflow causes a result of zero to be returned.

Invalid floating point operation.
  • The real value passed to Trunc or Round could not be converted

    to an integer within the Longint range (-2,147,483,648 to 2,147,483,647).

  • The argument passed to the Sqrt function was negative.

  • The argument passed to the Ln function was zero or negative.

  • An 8087 stack overflow occurred. For further details on correctly

    programming the 8087, see Chapter 14.

210 Call to an Abstract Function

You are trying to execute an abstract virtual method.

Arithmetic overflow error.

This error is reported by statements compiled in the {$Q+} state when an integer arithmetic operation caused an overflow, such as when the result of the operation was outside the supported range.

General Protection fault

This error results if you try to access memory that is not legal for your your application to access. The operating system halts your application and tells you that a general protection (GP) fault occurred, but your system does not crash. The following practices cause GP faults:

  • Dereferencing nil pointers

  • Using an object that has not been constructed

  • Loading constant values into segment registers

  • Performing arithmetic operations on segment registers of selectors

  • Using segment registers for temporary storage

  • Writing to code segments

  • Accessing memory beyond the local address space given to your

    application

Unhandled exception

An exception has occurred for which an exception handler could not be located.

219 Invalid typecast

The object given on the left hand side of an as operator is not of the class given on the right hand side of the operator.