Appendix F:

Small C Error Messages

When the compiler encounters an error condition it displays the erroneous line, an arrow pointing up to the approximate location of the error, and an explanatory error message. If instructed by the -P switch, the compiler pauses, waiting for the operator to press the ENTER key.

Some programs may cause the compiler to overflow one of its internal buffers. If that happens two alternatives are available: (1) recompile the compiler with more space for the offending buffer, or (2) revise the program to avoid the overflow condition.

The error messages which the compiler generates are listed below in alphabetic order with explanations. The explanations describe the intended use of the messages. Sometimes, however, an error message will surface because of conditions other than those anticipated by the compiler. So the text of a message may not always be entirely appropriate to the circumstances.

The error messages are explained below:

already defined

A name is being declared more than once at the global level or among the formal arguments of a function.

bad label

A goto statement has an improperly formed label. Either it does not conform to the C naming conventions or it is missing altogether.

can't subscript

A subscript is associated with something which is neither a pointer nor an array.

cannot assign to pointer

An initializer consisting of a constant or a constant expression is associated with a pointer. Integer pointers do not take initializers and character pointers take only expression-list or string initializers.

control statement nesting limit

The level of nesting of any combination of do , for , while, and switch statements exceeds the capacity of the while queue. This may be corrected by increasing the size of WQTABSZ in CC.H. WQTABSZ is the size (in bytes) of the while queue. It must be a multiple of WQSIZ.

global symbol table overflow

The global symbol table has overflowed. This may be corrected by recompiling the compiler with larger values assigned to the symbols NUMGLBS and SYMTBSZ in CC.H. NUMGLBS is the number of global entries the table will hold, and SYMTBSZ is the overall size (in bytes) of the combined local and global tables. A comment in the source text explains how to calculate SYMTBSZ.

illegal address

The address operator is applied to something which is neither a variable, a pointer, nor a subscripted pointer or array name.

illegal argument name

A name in a function's formal argument list does not conform to the C naming conventions.

illegal function or declaration

The compiler found something at the global level which is not a function or object declaration.

illegal symbol

The compiler found a symbol which does not conform to the C naming convention.

invalid expression

An expression contains a primary which is neither a constant, a string, nor a valid C name. Note that previously undeclared names (if they are correctly formed) are assumed to be function names and do not produce this error.

line too long

A source line, after preprocessing, is more than LINEMAX characters long. This can be corrected by breaking the line into parts. However, the compiler can be recompiled with larger values for LINEMAX and LINESIZE in CC.H. Note that LINESIZE must be one greater than LINEMAX.

literal queue overflow

A string constant would overflow the compiler's literal pool. The literal pool may be increased by recompiling the compiler with a larger value for LITABSZ in CC.H. LITABSZ is the size of the literal buffer in bytes.

local symbol table overflow

A local declaration would overflow the local symbol table. This may be corrected by recompiling the compiler with larger values for NUMLOCS and SYMTBSZ in CC.H. NUMLOCS is the number of entries in the table, and SYMTBSZ is the overall size (in bytes) of the combined local and global symbol tables. A comment in the source text shows how to calculate SYMTBSZ.

macro name table full

A #define command would overflow the macro name table. The table may be expanded by recompiling the compiler with larger values for MACNBR in CC.H. MACNBR is the number of names that will fit into the table.

macro string queue full

A #define command would overflow the macro string queue. This may be resolved by recompiling the compiler with a larger value for MACQSIZE in CC.H. MACQSIZE is the size of the macro-string buffer in bytes and is calculated as MACNBR*7. You could increase MACNBR or assume more than 7 bytes per substitution string on the average. The macro-string buffer must hold all of the replacement strings defined for the entire program being compiled.

mismatched expressions

The second and third expressions of a conditional operator ( expr1 ? expr2 : expr3 ) are not compatible. The compiler does not know to determine the attributes of the result.

missing token

The syntax requires a particular token which is missing.

multiple defaults

A switch contains more than one default prefix.

must assign to char pointer or char array

A string initializer is applied to something other than a character pointer or a character array.

must be constant expression

Something other than a constant expression was found where the syntax requires a constant expression.

must be lvalue

Something other than an lvalue is used as a receiving field in an expression. An lvalue is an expression (possibly just a name) for a storage location in memory which may be altered. Assigning something to a constant or an unsubscripted array name will produce this message.

must be object or type

The sizeof operator refers to something besides an object name or a type specification.

must declare first in block

A local declaration occurs after the first executable statement in a block.

need array size

A local array declaration does not specify the number of elements in the array.

negative size illegal

An array is dimensioned to a negative value. Recall that constant expressions may be used as array dimensions. Such an expression may very well evaluate to a negative value.

no apostrophe

A character constant lacks its terminating apostrophe.

no comma

An argument or declaration list lacks a separating comma.

no final }

The end of the input occurred while inside of a compound statement.

no matching #if...

An #else or #endif is not preceded by a corresponding #ifdef or #ifndef directive.

no open paren

An apparent function declarator lacks the left parenthesis which introduces the formal argument list.

no quote

A string constant lacks its terminating double quote. This quotation mark must be on the same line as the initial quotation mark.

no semicolon

A semicolon does not appear where the syntax requires one.

not a label

The name following the keyword goto is defined, but not as a label.

not allowed in switch

A local declaration occurs within the body of a switch statement. Small C disallows that possibility.

not allowed with block-locals

A goto statement occurs in a function which has local declarations in blocks below the highest level. Small C disallows that situation.

not allowed with goto

A local declaration occurs in a block below the highest level in a function which contains goto statements. Small C disallows that possibility.

not an argument

The names in a function's formal argument list do not match the corresponding type declarations.

not in switch

A case or default prefix occurs outside of a switch statement.

open failure on include file

An #include file cannot be opened.

out of context

A break statement is not located within a do, for, while, or switch statement, or a continue is not within a do, for, or while statement.

staging buffer overflow

The code generated by an expression exceeds the size of the staging buffer. This can be corrected by breaking the expression into several intermediate expressions, or by recompiling the compiler with a larger STAGESIZE in CC.H. STAGESIZE is the number of 4-byte entries in the staging buffer.

too many cases

The number of case prefixes in a switch exceeds the capacity of the switch table. The switch table may be enlarged by assigning a larger value to SWTABSZ in CC.H and recompiling the compiler. SWTABSZ is the size (in bytes) of the switch table. It must be a multiple of SWSIZ.

try (*...)()

An argument or local declaration specifies a function, instead of a function pointer.

wrong number of arguments

One or more of the formal arguments in a function header was not typed before entering the function body.

Go to Appendix G Return to Table of Contents