Руководство пользователя Free Pascal версии Версия документа Март 2010 Michael Van Canneyt, Florian Klampfl

Вид материалаРуководство пользователя
Подобный материал:
1   ...   8   9   10   11   12   13   14   15   16
Hint: Type size mismatch, possible loss of data / range check error There is an assignment to a smaller type than the source type. This means that this may cause a range-check error, or may lead to possible loss of data.


Error: The address of an abstract method can’t be taken An abstract method has no body, so the address of an abstract method can’t be taken.


Error: Assignments to formal parameters and open arrays are not possible You are trying to assign a value to a formal (untyped var, const or out) parameter, or to an open array.


Error: Constant Expression expected The compiler expects an constant expression, but gets a variable expression.


Error: Operation "arg1" not supported for types "arg2" and "arg3" The operation is not allowed for the supplied types.


Error: Illegal type conversion: "arg1" to "arg2" When doing a type-cast, you must take care that the sizes of the variable and the destination type are the same.


Hint: Conversion between ordinals and pointers is not portable If you typecast a pointer to a longint (or vice-versa), this code will not compile on a machine using 64 bits addressing.


Warning: Conversion between ordinals and pointers is not portable If you typecast a pointer to an ordinal type of a different size (or vice-versa), this can cause problems. This is a warning to help in finding the 32-bit specific code where cardinal/longint is used to typecast pointers to ordinals. A solution is to use the ptrint/ptruint types instead.


Error: Can’t determine which overloaded function to call You’re calling overloaded functions with a parameter that doesn’t correspond to any of the declared function parameter lists. e.g. when you have declared a function with parameters word and longint, and then you call it with a parameter which is of type integer.


Error: Illegal counter variable The type of a for loop variable must be an ordinal type. Loop variables cannot be reals or strings.


Warning: Converting constant real value to double for C variable argument, add explicit typecast to prevent this.


In C, constant real values are double by default. For this reason, if you pass a constant real value to a variable argument part of a C function, FPC by default converts this constant to double as well. If you want to prevent this from happening, add an explicit typecast around the constant.


Error: Class or COM interface type expected, but got "arg1" Some operators, such as the AS operator, are only applicable to classes or COM interfaces.


Error: Constant packed arrays are not yet supported You cannot declare a (bit)packed array as a typed constant.


Error: Incompatible type for arg no. arg1: Got "arg2" expected "(Bit)Packed Array" The compiler expects a (bit)packed array as the specified parameter.


Error: Incompatible type for arg no. arg1: Got "arg2" expected "(not packed) Array" The compiler expects a regular (i.e., not packed) array as the specified parameter.


Error: Elements of packed arrays cannot be of a type which need to be initialised Support for packed arrays of types that need initialization (such as ansistrings, or records which contain ansistrings) is not yet implemented.


Error: Constant packed records and objects are not yet supported You cannot declare a (bit)packed array as a typed constant at this time.


Warning: Arithmetic "arg1" on untyped pointer is unportable to {$T+}, suggest typecast Addition/subtraction from an untyped pointer may work differently in {$T+}. Use a typecast to a typed pointer.


Error: Can’t take address of a subroutine marked as local The address of a subroutine marked as local can’t be taken.


Error: Can’t export subroutine marked as local from a unit A subroutine marked as local can’t be exported from a unit.


Error: Type is not automatable: "arg1" Only byte, integer, longint, smallint, currency, single, double, ansistring, widestring, tdatetime, variant, olevariant, wordbool and all interfaces are automatable.


Hint: Converting the operands to "arg1" before doing the add could prevent overflow errors.


Adding two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the addition.


Hint: Converting the operands to "arg1" before doing the subtract could prevent overflow errors.


Subtracting two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the subtraction.


Hint: Converting the operands to "arg1" before doing the multiply could prevent overflow errors.


Multiplying two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the multiplication.


Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned


The virtual address space on 32-bit machines runs from $00000000 to $ffffffff. Many operating systems allow you to allocate memory above $80000000. For example both WINDOWS and LINUX allow pointers in the range $0000000 to $bfffffff. If you convert pointers to signed types, this can cause overflow and range check errors, but also $80000000 < $7fffffff. This can cause random errors in code like "if p>q".


Error: Interface type arg1 has no valid GUID When applying the as-operator to an interface or class, the desired interface (i.e. the right operand of the as-operator) must have a valid GUID.


Error: Invalid selector name An Objective-C selector cannot be empty, must be a valid identifier or a single colon, and if it contains at least one colon it must also end in one.


Error: Expected Objective-C method, but got arg1 A selector can only be created for Objective-C methods, not for any other kind of procedure/function/method.


Error: Expected Objective-C method or constant method name A selector can only be created for Objective-C methods, either by specifying the name using a string constant, or by using an Objective-C method identifier that is visible in the current scope.


Error: No type info available for this type Type information is not generated for some types, such as enumerations with gaps in their value range (this includes enumerations whose lower bound is different from zero).


C.5 Symbol handling


This section lists all the messages that concern the handling of symbols. This means all things that have to do with procedure and variable names.


Error: Identifier not found "arg1" The compiler doesn’t know this symbol. Usually happens when you misspell the name of a variable or procedure, or when you forget to declare a variable.


Fatal: Internal Error in SymTableStack() An internal error occurred in the compiler; If you encounter such an error, please contact the developers and try to provide an exact description of the circumstances in which the error occurs.


Error: Duplicate identifier "arg1" The identifier was already declared in the current scope.


Hint: Identifier already defined in arg1 at line arg2 The identifier was already declared in a previous scope.


Error: Unknown identifier "arg1" The identifier encountered has not been declared, or is used outside the scope where it is defined.


Error: Forward declaration not solved "arg1" This can happen in two cases:


• You declare a function in the interface part, or with a forward directive, but do not implement it.


• You reference a type which isn’t declared in the current type block.


Error: Error in type definition There is an error in your definition of a new array type. One of the range delimiters in an array declaration is erroneous. For example, Array [1..1.25] will trigger this error.


Error: Forward type not resolved "arg1" A symbol was forward defined, but no declaration was encountered.


Error: Only static variables can be used in static methods or outside methods A static method of an object can only access static variables.


Fatal: record or class type expected The variable or expression isn’t of the type record or class.


Error: Instances of classes or objects with an abstract method are not allowed You are trying to generate an instance of a class which has an abstract method that wasn’t overridden.


Warning: Label not defined "arg1" A label was declared, but not defined.


Error: Label used but not defined "arg1" A label was declared and used, but not defined.


Error: Illegal label declaration This error should never happen; it occurs if a label is defined outside a procedure or function.


Error: GOTO and LABEL are not supported (use switch -Sg) You must use the -Sg switch to compile a program which has labels and goto statements. By default, label and goto aren’t supported.


Error: Label not found A goto label was encountered, but the label wasn’t declared.


Error: identifier isn’t a label The identifier specified after the goto isn’t of type label.


Error: label already defined You are defining a label twice. You can define a label only once.


Error: illegal type declaration of set elements The declaration of a set contains an invalid type definition.


Error: Forward class definition not resolved "arg1" You declared a class, but you did not implement it.


Hint: Unit "arg1" not used in arg2 The unit referenced in the uses clause is not used.


Hint: Parameter "arg1" not used The identifier was declared (locally or globally) but was not used (locally or globally).


Note: Local variable "arg1" not used You have declared, but not used, a variable in a procedure or function implementation.


Hint: Value parameter "arg1" is assigned but never used The identifier was declared (locally or globally) and assigned to, but is not used (locally or globally) after the assignment.


Note: Local variable "arg1" is assigned but never used The variable in a procedure or function implementation is declared and assigned to, but is not used after the assignment.


Hint: Local arg1 "arg2" is not used A local symbol is never used.


Note: Private field "arg1.arg2" is never used The indicated private field is defined, but is never used in the code.


Note: Private field "arg1.arg2" is assigned but never used The indicated private field is declared and assigned to, but never read.


Note: Private method "arg1.arg2" never used The indicated private method is declared but is never used in the code.


Error: Set type expected The variable or expression is not of type set. This happens in an in statement.


Warning: Function result does not seem to be set You can get this warning if the compiler thinks that a function return value is not set. This will not be displayed for assembler procedures, or procedures that contain assembler blocks.


Warning: Type "arg1" is not aligned correctly in current record for C Arrays with sizes not multiples of 4 will be wrongly aligned for C structures.


Error: Unknown record field identifier "arg1" The field doesn’t exist in the record/object definition.


Warning: Local variable "arg1" does not seem to be initialized This message is displayed if the compiler thinks that a variable will be used (i.e. it appears in the right-hand side of an expression) when it was not initialized first (i.e. appeared in the left-hand side of an assignment).


Warning: Variable "arg1" does not seem to be initialized This message is displayed if the compiler thinks that a variable will be used (i.e. it appears in the right-hand side of an expression) when it was not initialized first (i.e. appeared in the left-hand side of an assignment).


Error: identifier idents no member "arg1" This error is generated when an identifier of a record, field or method is accessed while it is not defined.


Hint: Found declaration: arg1 You get this when you use the -vh switch.In the case of an overloaded procedure not being found. Then all candidate overloaded procedures are listed, with their parameter lists.


Error: Data element too large You get this when you declare a data element whose size exceeds the prescribed limit (2 Gb on 80386+/68020+ processors).


Error: No matching implementation for interface method "arg1" found There was no matching method found which could implement the interface method. Check argument types and result type of the methods.


Warning: Symbol "arg1" is deprecated This means that a symbol (a variable, routine, etc...) which is declared as deprecated is used. Deprecated symbols may no longer be available in newer versions of the unit / library. Use of this symbol should be avoided as much as possible.


Warning: Symbol "arg1" is not portable This means that a symbol (a variable, routine, etc...) which is declared as platform is used. This symbol’s value, use and availability is platform specific and should not be used if the source code must be portable.


Warning: Symbol "arg1" is not implemented This means that a symbol (a variable, routine, etc...) which is declared as unimplemented is used. This symbol is defined, but is not yet implemented on this specific platform.


Error: Can’t create unique type from this type Only simple types like ordinal, float and string types are supported when redefining a type with type newtype = type oldtype;.


Hint: Local variable "arg1" does not seem to be initialized This message is displayed if the compiler thinks that a variable will be used (i.e. it appears in the right-hand side of an expression) when it was not initialized first (i.e. it did not appear in the left-hand side of an assignment).


Hint: Variable "arg1" does not seem to be initialized This message is displayed if the compiler thinks that a variable will be used (i.e. it appears in the right-hand side of an expression) when it was not initialized first (i.e. t did not appear in the left-hand side of an assignment).


Warning: Function result variable does not seem to initialized This message is displayed if the compiler thinks that the function result variable will be used (i.e. it appears in the right-hand side of an expression) before it is initialized (i.e. before it appeared in the left-hand side of an assignment).


Hint: Function result variable does not seem to be initialized This message is displayed if the compiler thinks that the function result variable will be used (i.e. it appears in the right-hand side of an expression) before it is initialized (i.e. it appears in the left-hand side of an assignment)


Warning: Variable "arg1" read but nowhere assigned You have read the value of a variable, but nowhere assigned a value to it.


Hint: Found abstract method: arg1 When getting a warning about constructing a class/object with abstract methods you get this hint to assist you in finding the affected method.


Warning: Symbol "arg1" is experimental This means that a symbol (a variable, routine, etc...) which is declared as experimental is used. Experimental symbols might disappear or change semantics in future versions. Usage of this symbol should be avoided as much as possible.


Warning: Forward declaration "arg1" not resolved, assumed external This happens if you declare a function in the interface of a unit in macpas mode, but do not implement it.


C.6 Code generator messages


This section lists all messages that can be displayed if the code generator encounters an error condition.


Error: Parameter list size exceeds 65535 bytes The I386 processor limits the parameter list to 65535 bytes. (The RET instruction causes this.)


Error: File types must be var parameters You cannot specify files as value parameters, i.e., they must always be declared var parameters.


Error: The use of a far pointer isn’t allowed there Free Pascal doesn’t support far pointers, so you cannot take the address of an expression which has a far reference as a result. The mem construct has a far reference as a result, so the following code will produce this error:


var p : pointer;


...


p:=@mem[a000:000];


Error: EXPORT declared functions can’t be called No longer in use.


Warning: Possible illegal call of constructor or destructor The compiler detected that a constructor or destructor is called within a a method. This will probably lead to problems, since constructors / destructors require parameters on entry.


Note: Inefficient code Your statement seems dubious to the compiler.


Warning: unreachable code You specified a construct which will never be executed. Example:


while false do


begin


{.. code ...}


end;


Error: Abstract methods can’t be called directly You cannot call an abstract method directly. Instead, you must call an overriding child method, because an abstract method isn’t implemented.


Register arg1 weight arg2 arg3 Debugging message. Shown when the compiler considers a variable for keeping in the registers.


Stack frame is omitted Some procedure/functions do not need a complete stack-frame, so it is omitted. This message will be displayed when the -vd switch is used.


Error: Object or class methods can’t be inline. You cannot have inlined object methods.


Error: Procvar calls cannot be inline. A procedure with a procedural variable call cannot be in-lined.


Error: No code for inline procedure stored The compiler couldn’t store code for the inline procedure.


Error: Element zero of an ansi/wide-or longstring can’t be accessed, use (set)length instead You should use setlength to set the length of an ansi/wide/longstring and length to get the length of such string type.


Error: Constructors or destructors can not be called inside a ’with’ clause Inside a with clause you cannot call a constructor or destructor for the object you have in the with clause.


Error: Cannot call message handler methods directly A message method handler method cannot be called directly if it contains an explicit Self argument.


Error: Jump in or outside of an exception block It is not allowed to jump in or outside of an exception block like try..finally..end;. For example, the following code will produce this error:


label 1;


...


try


if not(final) then


goto 1; // this line will cause an error


finally


...


end;


1:


...


Error: Control flow statements aren’t allowed in a finally block It isn’t allowed to use the control flow statements break, continue and exit inside a finally statement. The following example shows the problem:


...


try


p;


finally


...


exit; // This exit ISN’T allowed


end;


...


If the procedure p raises an exception the finally block is executed. If the execution reaches the exit, it’s unclear what to do: exit the procedure or search for another exception handler.


Warning: Parameters size exceeds limit for certain cpu’s This indicates that you are declaring more than 64K of parameters, which might not be supported on other processor targets.


Warning: Local variable size exceed limit for certain cpu’s This indicates that you are declaring more than 32K of local variables, which might not be supported on other processor targets.


Error: Local variables size exceeds supported limit This indicates that you are declaring more than 32K of local variables, which is not supported by this processor.


Error: BREAK not allowed You’re trying to use break outside a loop construction.


Error: CONTINUE not allowed You’re trying to use continue outside a loop construction.


Fatal: Unknown compilerproc "arg1". Check if you use the correct run time library. The compiler expects that the runtime library contains certain subroutines. If you see this error and you didn’t change the runtime library code, it’s very likely that the runtime library you’re using doesn’t match the compiler in use. If you changed the runtime library this error means that you removed a subroutine which the compiler needs for internal use.


Fatal: Cannot find system type "arg1". Check if you use the correct run time library. The compiler expects that the runtime library contains certain type definitions. If you see this error and you didn’t change the runtime library code, it’s very likely that the runtime library you’re using doesn’t match the compiler in use. If you changed the runtime library this error means that you removed a type which the compiler needs for internal use.