view docs/ccguide/errors.appendix @ 2437:d26e96c40194

rfm changes
author aaronwolfe
date Wed, 24 Feb 2010 00:37:08 +0000
parents c8fcb9426d8b
children
line wrap: on
line source

<appendix>
<title>Compiler Generated Error Messages</title>
<para>
Below is a list of the error messages that the C compiler generates,
and, if applicable, probable causes and K &amp; R Appendix A section
number (in parenthesis) to see for more specific information.
</para>
<variablelist>
<varlistentry><term>already a local variable</term>
<listitem>
<para>
Variable has already been declared at the current block level.
(<xref linkend="cref8.1"/>, <xref linkend="cref9.2"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>argument : &lt;text&gt;</term>
<listitem>
<para>
Error from preprocessor. Self-explanatory. Most common cause
of this error is not being able to find an include file.
</para>
</listitem>
</varlistentry>

<varlistentry><term>argument error</term>
<listitem>
<para>
Function argument declared as type struct, union or function.
Pointers to such types, however are allowed. (<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>argument storage</term>
<listitem>
<para>
Function arguments may only be declared as storage class
register. (<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>bad character</term>
<listitem>
<para>
A character not in the C character set (probably a control
char) was encountered in the source file. (2)
</para>
</listitem>
</varlistentry>

<varlistentry><term>both must be integral</term>
<listitem>
<para>
&gt;&gt; and &lt;&lt; operands cannot be FLOAT or DOUBLE. (<xref linkend="cref7.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>break error</term>
<listitem>
<para>
The break statement is allowed only inside a while, do, for or
switch block. (<xref linkend="cref9.8"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>can't take address</term>
<listitem>
<para>
&amp; operator not allowed in a register variable. Operand must
otherwise be an lvalue. (<xref linkend="cref7.2"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>cannot cast</term>
<listitem>
<para>
Type result of cast cannot be FUNCTION or ARRAY. (<xref linkend="cref7.2"/>, <xref linkend="cref8.7"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>cannot evaluate size</term>
<listitem>
<para>
Could not determine size from declaration or initializer.
(<xref linkend="cref8.6"/>, <xref linkend="cref14.3"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>cannot initialize</term>
<listitem>
<para>
Storage class or type does not allow variable to be
initialized. (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>compiler trouble</term>
<listitem>
<para>
Compiler detedted something it couldn't handle. Try compiling
the program again. If this error still occurs, contact
Microware.
</para>
</listitem>
</varlistentry>

<varlistentry><term>condition needed</term>
<listitem>
<para>
While, do, for, switch and if statements require a condition
expression. (<xref linkend="cref9.3"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>constant expression required</term>
<listitem>
<para>
Initializer expressions for statis or external variables cannot
reference variables. They may, however, refer to the address
of a previously declared variable. This installation allows no
initializer expressions unless all operands are of type INT or
CHAR (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>constant overflow</term>
<listitem>
<para>
Input numeric constant was too large for the implied or
explicit type. (<xref linkend="cref2.6"/>, [PDP-11])
</para>
</listitem>
</varlistentry>

<varlistentry><term>constant required</term>
<listitem>
<para>
Variables are not allowed for array dimensions or cases. (<xref linkend="cref8.3"/>,
<xref linkend="cref8.7"/>, <xref linkend="cref9.7"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>continue error</term>
<listitem>
<para>
The continue statement is allowed only inside a while, do, or
for block. (<xref linkend="cref9.9"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>declaration mismatch</term>
<listitem>
<para>
This declaration conflicts with a previous one. This is
typically caused by declaring a function to return a non-integer
type after a reference has been made to the function.
Depending on the line structure of the declaration block, this
error may be reported on the line following the erroneous
declaration. (<xref linkend="cref11"/>, <xref linkend="cref11.1"/>, <xref linkend="cref11.2"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>divide by zero</term>
<listitem>
<para>
Divide by zero occurred when evaluating a constant expression.
</para>
</listitem>
</varlistentry>

<varlistentry><term>? expected</term>
<listitem>
<para>
? is any character that was expected to appear here. Missing
semicolons or braces cause this error.
</para>
</listitem>
</varlistentry>

<varlistentry><term>expression missing</term>
<listitem>
<para>
An expression is required here.
</para>
</listitem>
</varlistentry>

<varlistentry><term>function header missing</term>
<listitem>
<para>
Statement or expression encountered outside a function.
Typically causes by mismatched braces. (<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>function type error</term>
<listitem>
<para>
A function cannot be declared as returning an array, function,
struct, or union. (<xref linkend="cref8.4"/>, <xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>function unfinished</term>
<listitem>
<para>
End-of-file encountered before the end of function definition.
(<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>identifier missing</term>
<listitem>
<para>
Identifier name required here but none was found.
</para>
</listitem>
</varlistentry>

<varlistentry><term>illegal declaration</term>
<listitem>
<para>
Declarations are allowed only at the beginning of a block.
(<xref linkend="cref9.2"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>label required</term>
<listitem>
<para>
Label name required on goto statement. (<xref linkend="cref9.1"/>1)
</para>
</listitem>
</varlistentry>

<varlistentry><term>label undefined</term>
<listitem>
<para>
Goto to label not defined in the current function. (<xref linkend="cref9.12"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>lvalue required</term>
<listitem>
<para>
Left side of assigment must be able to be "stored into".
Array names, functions, structs, etc. are no lvalues. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>multiple defaults</term>
<listitem>
<para>
Only one default statement is allowed in a switch block. (<xref linkend="cref9.7"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>multiple definition</term>
<listitem>
<para>
Identifier name was declared more than once in the same block
level (<xref linkend="cref9.2"/>, <xref linkend="cref11.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>must be integral</term>
<listitem>
<para>
Type of object required here must be type int, char or pointer.
</para>
</listitem>
</varlistentry>

<varlistentry><term>name clash</term>
<listitem>
<para>
Struct-union member and tag names must be mutually distinct.  (<xref linkend="cref8.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>name in cast</term>
<listitem>
<para>
Identifier name found in a cast. Only types are allowed. (<xref linkend="cref7.2"/>, <xref linkend="cref8.7"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>named twice</term>
<listitem>
<para>
Names in a function parameter list may appear only once. (<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>no 'if' for 'else'</term>
<listitem>
<para>
Else statement found with no matching if. This is typically
caused by extra or missing braces and/or semicolons. (<xref linkend="cref9.3"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>no switch statement</term>
<listitem>
<para>
Case statements can only appear within a switch block. (<xref linkend="cref9.7"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>not a function</term>
<listitem>
<para>
Primary in expression is not type "function returning...". If
this is really a function call, the function name was declared
differently elsewhere. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>not an argument</term>
<listitem>
<para>
Name does not appear in the function parameter list. (<xref linkend="cref10.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>operand expected</term>
<listitem>
<para>
Unary operators require one operand, binary operators two.
This is typically caused by misplaced parenthesis, casts or
operators. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>out of memory</term>
<listitem>
<para>
Compiler dynamic memory overflow. The compiler requires
dynamic memory for symbol table entries, block level
declarations and code generation. Three major factors affect
this memory usage. Permanent declarations (those appearing on
the outer block level (used in include files)) must be
reserved from the dynamic memory for the duration of the
compilation of the file. Each { causes the compiler to perform
a block-level recursion which may involve "pushing down"
previous declarations which consume memory. Auto class
initializers require saving expression trees until past the
declarations which may be very memory-expensive if may exist.
Avoiding excessive declarations, both permanent and inside
compound statement blocks conserve memory. If this error
occurs on an auto initializer, try initializing the value in
the code body.
</para>
</listitem>
</varlistentry>

<varlistentry><term>pointer mismatch</term>
<listitem>
<para>
Pointers refer to different types. Use a case if required. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>pointer or integer required</term>
<listitem>
<para>
A pointer (of any type) or integer is required to the left of
the '-&gt;' operator. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>pointer required</term>
<listitem>
<para>
Pointer operand required with unary * operator. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>primary expected</term>
<listitem>
<para>
Primary expression required here. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>should be NULL</term>
<listitem>
<para>
Second and third expression of ?: conditional operator cannot
be pointers to different types. If both are pointers, they
must be of the same type or one of the two must be null. (<xref linkend="cref7.13"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>**** STACK OVERFLOW ****</term>
<listitem>
<para>
Compiler stack has overflowed. Most likely cause is very deep
lock-level nesting or hundreds of switch cases.
</para>
</listitem>
</varlistentry>

<varlistentry><term>storage error</term>
<listitem>
<para>
Reg and auto storage classes mey only be used within functions.
(<xref linkend="cref8.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>struct member mismatch</term>
<listitem>
<para>
Identical member names in two different structures must have
the same type and offset in both. (<xref linkend="cref8.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>struct member required</term>
<listitem>
<para>
Identifier used with . and -&gt; operators must be a structure
member name. (<xref linkend="cref7.1"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>struct syntax</term>
<listitem>
<para>
Brace, comma, etc. is missing in a struct declaration. (<xref linkend="cref8.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>struct or union inappropiate</term>
<listitem>
<para>
Struct or union cannot be used in the context.
</para>
</listitem>
</varlistentry>

<varlistentry><term>syntax error</term>
<listitem>
<para>
Expression, declaration or statement is incorrectly formed.
</para>
</listitem>
</varlistentry>

<varlistentry><term>third expression missing</term>
<listitem>
<para>
? must be followed by a : with expression. This error may be
causes by unmatched parenthesis or other errors in the
expression. (<xref linkend="cref7.13"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>too long</term>
<listitem>
<para>
Too many characters provided in a string initializing a
character array. (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>too many brackets</term>
<listitem>
<para>
Unmatched or unexpected brackets encountered processiong an
initializer. (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>too many elements</term>
<listitem>
<para>
More data items supplied for aggregate level in initializer
than members of the aggregate. (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>type error</term>
<listitem>
<para>
Compiler type matching error. Should never happen.
</para>
</listitem>
</varlistentry>

<varlistentry><term>type mismatch</term>
<listitem>
<para>
Types and/or operators in expression do not correspond. (6)
</para>
</listitem>
</varlistentry>

<varlistentry><term>typedef - not a variable</term>
<listitem>
<para>
Typedef type name cannot be used in this manner. (<xref linkend="cref8.8"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>undeclared variable</term>
<listitem>
<para>
no declaration exists at any block level for this identifier.
</para>
</listitem>
</varlistentry>

<varlistentry><term>undefined structure</term>
<listitem>
<para>
Union or struct declaration refers to an undefined structure
name. (<xref linkend="cref8.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>unions not allowed</term>
<listitem>
<para>
Cannot initialize union members. (<xref linkend="cref8.6"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>unterminated character constant</term>
<listitem>
<para>
Unmatched ' character delimiters. (<xref linkend="cref2.4.3"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>unterminated string</term>
<listitem>
<para>
Unmatched " string delimiters. (<xref linkend="cref2.5"/>)
</para>
</listitem>
</varlistentry>

<varlistentry><term>while expected</term>
<listitem>
<para>
No while found for do statement. (<xref linkend="cref9.5"/>)
</para>
</listitem>
</varlistentry>

</variablelist>
</appendix>