www.riscos.com Technical Support:
Acorn C/C++


C errors and warnings

This appendix gives a brief description of the intended purposes of error and warning messages from the CC tool, along with some hints for interpreting them. It then lists most of the common errors in alphabetical order. It is not a complete list. Since the messages are designed as far as possible to be self-explanatory, some of the more simple common ones are not listed here.

Interpreting CC errors and warnings

The compiler can produce error and warning messages of several degrees of severity. They are as follows:

  • Warnings indicating curious, but legal, program constructs, or constructs that are indicative of potential error;
  • Non-serious errors that still allow code to be produced;
  • Serious errors that may cause loss of code;
  • Fatal errors that may stop the compiler from compiling;
  • System errors that signal faults in the system itself.

Warnings from CC are intended to provide a helpful level of checking, in addition to the level required by the ANSI standard. On some other systems, such as UNIX, separate facilities (like lint) are provided to perform this checking. Warnings flag program constructs that may indicate potential errors, or those not recommended because they may function differently on other machines, and hence hinder the portability of code.

Some warnings point out the use of facilities provided in this ANSI C implementation which are above the minimum required by ANSI - for example, use of external identifiers that are identical in the first six characters, which may not be differentiated by other systems which conform to the ANSI standard.

Programs ported from other machines may cause large numbers of warning messages from CC, which you can disable with the Suppress warnings option (see Suppress warnings for more information).

You can also enable additional checks with the CC and C++ Features option. This is best done in the final stages of a project, and will help you to produce high-quality software.

Errors and serious errors collectively respond to ANSI 'diagnostics'; whether an error is serious or not reflects the compiler's view, not yours, or that of the ANSI committee.

After issuing a warning, non-serious, or serious error, CC continues compiling, sometimes producing more such messages in the process. Compilation of C by CC can be thought of as a pipeline process, starting with preprocessing, syntax analysis, then semantic analysis (when the structure of a portion of code is analysed). When syntax errors in C are encountered by CC, the compiler can often guess what the error was, correct it, and continue. When semantic errors are found, portions of your code are often ignored before continuing, and serious error messages are reported.

Unfortunately, the compact and powerful nature of C leads to a high proportion of semantic errors. Ignoring portions of your code is likely to make subsequent portions incorrect, so one serious error can often start a cascade of error messages. Often, therefore, it is sensible to ignore a set of error messages following a serious error message.

If the compiler produces any message more serious than a warning, it will set a bad return code, usually terminating any 'make' of which it is a part in the process. Any serious error will cause the output object file to be deleted; fatal and system errors cause immediate termination of compilation, with loss of the object file and bad return code set.

Future releases of the compiler may distinguish further forms of error, or produce slightly different forms of wording.

In pcc mode, constructs that are erroneous in ANSI mode are reported, even though legal in pcc mode.


Warning messages indicate legal but curious C programs, or possibly unintended constructs (unless warnings are suppressed). On detection of such a condition, the compiler issues a warning message, then continues compilation.

Warning messages

'&' unnecessary for function or array xx

This is a reminder that if xx is defined as char xx[10] then xx already has a pointer type. There is a similar reminder for function names too. Example:

static char mesg[] = "hello\n";
int main ()
  char *p = &mesg; /* mesg is already compatible with char * */

actual type 'xx' mismatches format '%x'

A type error in a printf or scanf format string. Example:

  int i;
  printf("%s\n", i); /* %s need char* not int */

ANSI 'xx' trigraph for 'x' found - was this intended?

This helps to avoid inadvertent use of ANSI trigraphs. Example:

printf("Type ??/!!: "); /* "??/" is trigraph for "\" */

argument and old-style parameter mismatch : xx

A function with a non-ANSI declaration has been called using a parameter of a wrong data type. Example:

int fnl(a , b)
int a;
int b;
  return a * b;
int main()
  int l; float m;
  fnl(l , m);     /* m should be 'int' */

character sequence /* inside comment

You cannot nest comments in C. Example:

/* comment out func() for now...
/* func() returns a random number */
int func(void)
  return i;

Dangling 'else' indicates possible error

This hints that you may have mismatched your ifs and elses. Remember an else always refers to the most recent unmatched if. Use braces to avoid ambiguity. Example:

if (a)
   if (b)
   return 1;
   else if (c)
   return 2;
  else /* this belongs to the if (a). Or does it?*/
   return 3;

Deprecated declaration of xx() - give arg types

A feature of the ANSI standard is that argument types should be given in function declarations (prototypes). 'No arguments' is indicated by void. Example:

extern int func(); /* should have 'void' in the parentheses */

extern clash xx , xx clash (ANSI 6 char monocase)

Using compiler Feature option e, it was found that two external names were not distinct in the first six characters. Some linkers provide only six significant characters in their symbol table. Example:

extern double function1 (int i);
extern char * function2 (long l);

extern 'main' needs to be 'int' function

This is a reminder that main() is expected to return an integer. Example:

void main()

extern xx not declared in header

Compiling with Feature h, an external object was discovered which was not declared in any included header file.

floating point constant overflow

This is typically caused by a division by zero in a floating point constant expression evaluated at compile time. Example:

#define lim 1
#define eps 0.01
static float a = eps/(lim-1); /* lim-1 yields 0 */

floating to integral conversion failed

A cast (possibly implicit) of a floating point constant to an integer failed at compile time. Example:

static int i = (int) 1.0e20; /* INT_MAX is about 2e10 */

formal parameter 'xx' not declared - 'int' assumed

The declaration of a function parameter is missing. Example:

int func(a)
/*a should be declared here or within the parentheses*/

Format requires nn parameters, but mm given

Mismatch between a printf or scanf format string and its other arguments. Example:

printf("%d, %d\n",1); /* should be two ints */

function xx declared but not used

When compiling with Feature v, the function xx was declared but not used within the source file.

Illegal format conversion '%x'

Indicates an illegal conversion implied by a printf or scanf format string. Example:

printf("%w\n",10); /* no such thing as %w */

implicit narrowing cast : xx

An arithmetic operation or bit manipulation is attempted involving assignment from one data type to another, where the size of the latter is naturally smaller than that of the assigned value. Example:

double d = 1.0; long l = 2L; int i = 3;
i = d * i;
i = 1 | 3;
i = 1 & ~1;

implicit return in non-void function

A non-void function may exit without using a return statement, but won't return a meaningful result. Example:

int func(int a)
  int b=a*10;
  .../* no return <expr> statement */

incomplete format string

A mistake in a printf or scanf format string. Example:

printf("Score was %d%",score); /* 2nd % should be %% */

'int xx()' assumed - 'void' intended?

If the definition of a function omits its return type - it defaults to int. You should be explicit about the type, using void if the function doesn't return a result. Example:


inventing 'extern int xx();'

The declaration of a function is missing. Example:

  printf("Type your name: ");
  /* forgot to #include <stdio.h> */

lower precision in wider context: xx

An arithmetic operation or bit manipulation is attempted involving assignment from int, short or char to long. Example:

long l = 1L; int i = 2; short j = 3;
l = i & j;
l = i | 5;
l = i * j;

One circumstance in which this causes problems is when code like

long f(int x){return 1<<x;}

(which fails if int has 16 bits) is moved to machines such as the IBM PC.

No side effect in void context: 'op'

An expression which does not yield any side effect was evaluated; it will have no effect at run-time. Example:


no type checking of enum in this compiler

Compiling with Feature x, an enum declaration was found, and this message refers to the ANSI stipulation that enum values be integers, less strictly typed than in some earlier dialects of C.

Non-ANSI #include <xx>

A header file has been #included which is not defined in the ANSI standard. < > should be replaced by " ".

non-portable - not 1 char in 'xx'

Assigning character constants containing more than one character to an int will produce non-portable results. Example:

static int exitCode = 'ABEX';

non-value return in a non-void function

The expression was omitted from a return statement in a function which was defined with a non-void return type. Example:

int func(int a)

  int b=a*10;
  return; /* no <expr> */

odd unsigned comparison with 0 : xx

An attempt has been made to determine whether an unsigned variable is negative. Example:

unsigned u , v;
if (u < 0) u = u * v;
if (u >= 0) u = u / v;

Old-style function: xx

Compiling with Feature o, it was noted that the code contains a non-ANSI function declaration. Example:

void fn2(a , b)
int a;
int b;
{ b = a; }

omitting trailing '\0' for char[nn]

The character array being equated to a string is one character too short for the whole string, so the trailing zero is being omitted. Example:

static char mesg[14] = "(C)1988 Acorn\n";/* needs 15 */

repeated definition of #define macro xx

When compiling with Feature h, a macro has been repeatedly #defined to take the same value.

shift by nn illegal in ANSI C

This is given for negative constant shifts or shifts greater than 31. On the ARM, the bottom byte of the number given is used, ie it is treated as (unsigned char) nn. NB: negative shifts are not treated as positive shifts in the other direction. Example:


'short' slower than 'int' on this machine (see manual)

For speed you are advised to use ints rather than shorts where possible. This is because of the overhead of performing implicit casts from short to int in expression evaluation. However, shorts are half the size of ints, so arrays of shorts can be useful. Example:

  short i,j; /* quicker to use ints */

spurious {} around scalar initialiser

Braces are only required around structure and array initialises. Example:

static int i = {INIT_I}; /* don't need braces */

static xx declared but not used

A static variable was declared in a file but never used in it. It is therefore redundant.

Unrecognised #pragma (no '-' or unknown word)

#pragma directives are of the form

#pragma -xd
#pragma long_spelling

where x is a letter and d is an optional digit. These messages warn against unknown letters and missing minus signs.

use of 'op' in condition context

Warns of such possible errors as = and not == in an if or looping statement. Example:

  if (a=b) {

variable xx declared but not used

This refers to an automatic variable which was declared at the start of a block but never used within that block. It is therefore redundant. Example:

int func(int p)
  int a;        /* this is never used */
  return p*100;

xx may be used before being set

Compiling with Feature a, an automatic variable is found to have been used before any value has been assigned to it.

xx treated as xxul in 32-bit implementation

This message warns of two's complement arithmetic's dependence on assigning negative constants to unsigned ints, and it explains that ints and long ints are both 32 bits.

Non-serious errors

These are errors which will allow 'working' code to be produced - they will not produce loss of code. On detection of such an error the compiler issues an error message, if enabled, then continues compilation.

',' (not ';') separates formal parameters

Incorrect punctuation between function parameters. Example:

extern int func(int a;int b);

ANSI C does not support 'long float'

This used to be a synonym for double, but is not allowed in ANSI C.

ancient form of initialisation, use '='

An obsolete syntax for initialisation was used, or incorrectly nested brackets have been found. Example:

int i{1}; /* use int i=1; */

array [0] found

The minimum subscript count allowed is 1. (Remember that the subscripts go from 0 - n-1.) Example:

static int a[0];

array of xx illegal - assuming pointer

Illegal objects have been declared to occupy an array. Examples:

int fn2[5](); /* array of functions */
void v[10];   /* array of voids */

assignment to 'const' object 'xx'

You can't assign to objects declared as const. Example:

  const int ic = 42; /* initialisation ok */
  ic = 69; /* can't change it now */

comparison 'op' of pointer and int:
literal 0 (for == and !=) is the only legal case

You cannot use the comparison operators between an integer and a pointer type. As the message implies, you can only check for a pointer being (not) equal to NULL (int 0). Example:

  int i,j,*ip;
  j = i>ip; /* can't compare an int and an int * */

declaration with no effect

The compiler detected what appeared to be a declaration statement, but which resulted in no store being allocated. This may imply that a data type name was omitted.

differing pointer types: 'xx'

An illegal implicit type cast was detected in a comparison operation between two pointers of different types. Example:

  int  *ip;
  char *cp;
  printf("%d\n", ip==cp); /* can't compare these */

differing redefinition of #define macro xx

#define gives a definition contradicting that already assigned to the named macro.

ellipsis (...) cannot be only parameter

Although C allows variable length argument lists, the '...' parameter cannot stand alone in this function declaration. Example:

void fnl(...) { }

expected 'xx' or 'x' - inserted 'x' before 'yy'

Often caused by omitting a terminating symbol in a statement when the compiler is able to insert this symbol for you, and then to recover. Example:

int f(int j)
  return j;
int main()
  int i=f(10;     /* ')' omitted here */
  return i;

formal name missing in function definition

This error occurs when a comma in a function definition led the compiler to suspect a further formal parameter was going to follow, but none did. Example:

int a(int b,) /* missing parameter */

function prototype formal 'xx' needs type or class - 'int' assumed

A formal parameter in a function prototype was not given a type or class. It needs at least one of these (register being the only allowed class). Example:

void func(a); /* I mean int a or perhaps register a */

function returning xx illegal - assuming pointer

A function apparently intends to return an illegal object. Example:

int fn3()[] /* hoping to return an array */
  int list[3] = {1,2,3};
  return list;

function xx may not be initialised - assuming function pointer

A function is not a variable, so cannot be initialised. As an attempt to initialise xx has been made, xx is treated as of type function *. Example:

extern int func(void);
static int fn() = func; /* the compiler will use
   static int (*fn)() = func; instead */

<int> op <pointer> treated as <int> op (int)<pointer>

Warns of an illegal implicit cast within an expression. Typically op is an operator which has no business being used on pointers anyway, such as | or dyadic *. Example:

  int i, *ip;
  i = i | ip; /* bitwise-or on a pointer?! */

junk at end of #xx line - ignored

The xx is either else or endif. These directives should not have anything following them on the line. Example:

/* text after the #else should be a comment */
#else if it isn't defined

L'...' needs exactly 1 wide character

The wchar_t declaration of a wide character names an identifier comprising other than one character. Example:

wchar_t wc = L'abc';

linkage disagreement for 'xx' - treated as 'xx'

There was a linkage type disagreement for declarations, eg a function was declared as extern then defined later in the file as static. Example:

int func(int a); /* compiler assumes extern here */
static func(int a) /* but told static here */

more than 4 chars in character constant

A character constant of more than four characters cannot be assigned to a 32 bit int. Example:

  int i = '12345'; /* more than four chars */

no chars in character constant ''

At least one character should appear in a character constant. The empty constant is taken as zero. Example:

  int i = ''; /* less than one char == '\0' */

objects that have been cast are not l-values

The programmer tried to use a cast expression as an l-value. Example:

char *p;
*((int *)p)=10; /* (int *)p is NOT an l-value */

omitted <type> before formal declarator - 'int' assumed

This is given in a formal parameter declaration where a type modifier is given but no base type. Example:

int func(*a); /* a is a pointer, but to what? */

'op': cast between function pointer and non-function object

Casts between function and object pointers can be very dangerous! One possibly valid (but still very suspect) use is in casting an array of int into which machine code has been loaded into a function pointer. Example:

static int mcArray[100];
/*pointer to function returning void*/
typedef void (*pfv)(void);
     ((pfv)mcArray)(); /* convert to fn type and apply */

'op': implicit cast of non-0 int to pointer

Zero, equal to a NULL pointer, is the only int which can be legally implicitly cast to a pointer type. Example:

  int i, *ip;
  ip = i; /* only the constant int 0 can be implicitly
             cast to a pointer type */

'op': implicit cast of pointer to non-equal pointer

An illegal implicit cast has been detected between two different pointer types. The type casting must be made explicit to escape this error. Example:

  int   *ip;
  char  *cp;
  ip = cp; /* differing pointer types */

'op': implicit cast of pointer to 'int'

An illegal implicit cast has been detected between an integer and a pointer. Such casts must be made explicitly. Example:

  int i, *ip;
  i = ip; /* pointer must be cast explicitly */

overlarge escape '\\xxxx' treated as '\\xxx'

A hexadecimal escape sequence is too large. Example:

int novalue()
  if (seize) return '\xfff'; /* \xfff' too large */
  else return '\xff';

overlarge escape '\\x' treated as '\\x'

An octal escape sequence is too large. Example:

int novalue()
  if (huit) return '\777'; /* \777 too large */
  else return '\77';

<pointer> op <int> treated as (int)<pointer> op <int>

The only legal operators allowed in this context are + and -.

prototype and old-style parameters mixed

Use has been made of both the ANSI style function/definition (including a type name for formal parameters in a function's heading) and pcc style parameters lists. Example:

void fn4(a, int b)
int a;
  a = b;

'register' attribute for 'xx' ignored when address taken

Addresses of register variables cannot be calculated, so an address being taken of a variable with a register storage class causes that attribute to be dropped. Example:

  register int i, *ip;
  ip = &i; /* & forces i to lose its register attribute */

return <expr> illegal for void function

A function declared as void must not return with an expression. Example:

void a(void)
  return 0;

size of 'void' required - treated as 1

This indicates an attempt to do pointer arithmetic on a void *, probably indicating an error. Example:

  void *vp;
  vp++; /* how many bytes to increment by ? */

size of a [] array required - treated as [1]

If an array is declared as having an empty first subscript size, the compiler cannot calculate the array's size. It therefore assumes the first subscript limit to be 1 if necessary. This is unlikely to be helpful.

extern int array[][10];
static int s = sizeof(array); /*can't determine this*/

sizeof <bit field> illegal - sizeof(int) assumed

Bitfields do not necessarily occupy an integral number of bytes but they are always parts of an int, so an attempt to take the size of a bitfield will return sizeof(int). Example:

struct s {
  int exp : 8;
  int mant : 23;
  int s : 1;
int main(void)
  struct s st;
  int i = sizeof(st.exp); /* can't obtain this in bytes */

Small (single precision) floating value converted to 0.0 Small floating point value converted to 0.0

A floating point constant was so small that it had to be converted to 0.0. Example:

static float f = 1.0001e-38 - 1.0e-38; /* 1e-42 too small for float */

Spurious #elif ignored
Spurious #else ignored
Spurious #endif ignored

One of these three directives was encountered outside any #if or #ifdef scope. Example:

#if defined sym
#else /* this one is spurious */

static function xx not defined - treated as extern

A prototype declares the function to be static, but the function itself is absent from this compilation unit.

string initialiser longer than char [nn]

An attempt was made to initialise a character array with a string longer than the array. Example:

static char str[10] = "1234567891234";

struct component xx may not be function - assuming function pointer

A variable such as a structure component cannot be declared to have type function, only function *. Example:

struct s {
  int fn(); /* compiler will use int (*fn)(); */
  char c;

type or class needed (except in function definition) - int assumed

You can't declare a function or variable with neither a return type nor a storage class. One of these must be present. Examples:

func(void); /* need, eg, int or static */

Undeclared name, inventing 'extern int xx'

The name xx was undeclared, so the default type extern int was used. This may produce later spurious errors, but compilation continues. Example:

int main(void) {
  int i = j; /*j has not been previously declared*/

unprintable character xx found - ignored

An unrecognised character was found embedded in your source - this could be file corruption, so back up your sources! Note that 'unprintable character' means any non-whitespace, non-printable character.

variable xx may not be function - assuming function pointer

A variable cannot be declared to have type function, only function *. Example:

int main(void)
  auto void fn(void); /* treated as void (*fn)(void);*/

xx may not have whitespace in it

Tokens such as the compound assignment operators (+= etc) may not have embedded whitespace characters in them. Example:

  int i;
  i + = 4; /* space not allowed between + and = */

Serious errors

These are errors which will cause loss of generated code. On detection of such an error, the compiler will attempt to continue and produce further diagnostic messages, which are sometimes useful, but will delete the partly produced object file.

'...' must have exactly 3 dots

This is caused by a mistake in a function prototype where a variable number of arguments is specified. Example:

extern int printf(const char *format,....); /*one . too many*/

'{' of function body expected - found 'xx'

This is produced when the first character after the formal parameter declarations of a function is not the { of the function body. Example:

int func(a)
int a;
  if (a) ... /* omitted the { */

'{' or <identifier> expected after 'xx', but found 'yy'

xx is typically struct or union, which must be followed either by the tag identifier or the open brace of the field list. Example:

struct *fred; /* Missed out the tag id */

'xx' variables may not be initialised

A variable is of an inappropriate class for initialisation. Example:

int main()
  extern int n=1;
  return 1;

'op': cast to non-equal 'xx' illegal
'op': illegal cast of 'xx' to pointer
'op': illegal cast to 'xx'

These errors report various illegal casting operations. Examples:

struct s {
  int a,b;
struct t {
  float ab;
int main(void)
  int i;
  struct s s1;
  struct t s2;
/* '=': illegal cast to 'int' */
  i = s1;
/* '=': illegal cast to non-equal 'struct' */
  s1 = s2;
/* <cast>: illegal cast of 'struct' to pointer */
  i = *(int *) s1;
/* <cast>: illegal cast to 'int' */
  i = (int) s2;

'op': illegal use in pointer initialiser

(Static) pointer initialisers must evaluate to a pointer or a pointer constant plus or minus an integer constant. This error is often accompanied by others. Example:

extern int count;
static int *ip = &count*2;

{} must have 1 element to initialise scalar

When a scalar (integer or floating type) is initialised, the expression does not have to be enclosed in braces, but if they are present, only one expression may be put between them. Example:

static int i = {1,2}; /* which one to use? */

Array size nn illegal - 1 assumed

Arrays have a maximum dimension of 0xffffff. Example:

static char dict[0x1000000]; /* Too big */

attempt to apply a non-function

The function call operator () was used after an expression which did not yield a pointer to function type. Example:

  int i;

Bit fields do not have addresses

Bitfields do not necessarily lie on addressable byte boundaries, so the & operator cannot be used with them. Example:

struct s {
  int h1,h2 : 13;
int main(void)
  struct s s1;
  short *sp = &s1.h2; /* can't take & of bit field */

Bit size nn illegal - 1 assumed

Bitfields have a maximum permitted width of 32 bits as they must fit in a single integer. Example:

struct s {
  int f1 : 40; /* This one is too big */
  int f2 : 8;

'break' not in loop or switch - ignored

A break statement was found which was not inside a for, while or do loop or switch. This might be caused by an extra }, closing the statement prematurely. Example:

int main(int argc)
  if (argc == 1)

'case' not in switch - ignored

A case label was found which was not inside a switch statement. This might be caused by an extra }, closing the switch statement prematurely. Example:

void fn(void)
  case '*': return;

<command> expected but found a 'op'

This error occurs when a (binary) operator is found where a statement or side-effect expression would be expected. Example:

if (a) /10; /* mis-placed ) perhaps? */

'continue' not in loop - ignored

A continue statement was found which was not inside a for, while or do loop. This might be caused by an extra }, closing the loop statement prematurely. Example:

while (cc) {
  if (dd)    /* intended a { here */
  }          /* this closes the while */
  if (ee)

'default' not in switch - ignored

A default label was found which was not inside a switch statement. This might be caused by an extra }, closing the switch statement prematurely. Example:

switch (n) {
  case 0:
    return fn(n);
  case 1: if (cc)
    return -1;
  } /* spurious } closes the switch */

duplicated case constant: nn

The case label whose value is nn was found more than once in a switch statement. Note that nn is printed as a decimal integer regardless of the form the expression took in the source. Example:

switch (n) {
  case ' ':
  case ' ':

duplicate 'default' case ignored

Two cases in a single switch statement were labelled default. Example:

switch (n) {

duplicate definition of 'struct' tag 'xx'

There are duplicate definitions of the type struct xx {...} ;. Example:

struct s { int i,j;};
struct s {float a,b;};

duplicate definition of 'union' tag 'xx'

There are duplicate definitions of the type union xx {...} ;. Example:

union u {int i; char c[4];};
union u {double d; char c[8];};

duplicate type specification of formal parameter 'xx'

A formal function parameter had its type declared twice, once in the argument list and once after it. Example:

void fn(int i)
int i; /* this one is redundant */

EOF in comment
EOF in string
EOF in string escape

These all refer to unexpected occurrences of the end of the source file.

Expected <identifier> after 'xx' but found 'xx'
expected 'xx' - inserted before 'yy'

This typically occurs when a terminating semi-colon has been omitted before a }. (Common amongst Pascal programmers) Another case is the omission of a closing bracket of a parenthesised expression. Examples:

int fn(int a, int b, int c)
  int d = a*(b+c; /* missing ) */
  return d /* missing ; */

Expecting <declarator> or <type>, but found 'xx'

xx is typically a punctuation character found where a variable or function declaration or definition would be expected (at the top level). Example:

static int i = MAX;+1; /* spurious ; ends expression */

<expression> expected but found 'op'

Similar to above. An operator was found where an operand might reasonably be expected. Example:

func(>>10); /* missing left hand side of >> */

grossly over-long floating point number

Only a certain number of decimal digits are needed to specify a floating point number to the accuracy that it can be stored to. This number of digits was exceeded by an unreasonable amount.

grossly over-long number

A constant has an excessive number of leading zeros, not affecting its value.

hex digit needed after 0x or 0X

Hexadecimal constants must have at least one digit from the set 0-9, a-f, A-F following the 0x. Example:

int i = 0xg; /* illegal hex char */

<identifier> expected but found 'xx' in 'enum' definition

An unexpected token was found in the list of identifiers within the braces of an enum definition. Example:

enum colour {red, green, blue,;}; /* spurious ; */

identifier (xx) found in <abstract declarator> - ignored

The sizeof() function and cast expressions require abstract declarators, ie types without an identifier name. This error is given when an identifier is found in such a situation. Examples:

  i = (int j) ip; /* trying to cast to integer */
  l = sizeof(char str[10]); /* probably just mean sizeof(str) */

illegal bit field type 'xx' - 'int' assumed

Int (signed or unsigned) is the only valid bitfield type in ANSI-conforming implementations. Example:

struct s { char a : 4; char b : 4;};

illegal in case expression (ignored): xx
illegal in constant expression: xx
illegal in floating type initialiser: xx

All of these errors occur when a constant is needed at compile time but a variable expression was found.

illegal in l-value: 'enum' constant 'xx'

An incorrect attempt was made to assign to an enum constant. This could be caused by misspelling an enum or variable identifier. Example:

enum col {red, green, blue};
int fn()
  int read;
  red = 10;

illegal in the context of an l-value: 'xx'
illegal in lvalue: function or array 'xx'

An incorrect attempt was made to assign to xx, where the object in question is not assignable (an l-value). You can't, for example, assign to an array name or a function name. Examples:

  int a,b,c;
  a ? b : c = 10; /* ?: can't yield l-values. */
  if (a)          /* use this instead */
    b = 10;
    c = 10;

or, in the same context,

*(a ? &b: &c) = 10;

illegal in static integral type initialiser: xx

A constant was needed at compile time but a suitable expression wasn't found.

illegal types for operands : 'op'

An operation was attempted using operands which are unsuitable for the operator in question. Examples:

  struct {int a,b;} s;
  int i;
  i = *s;  /* can't indirect through a struct */
  s = s+s; /* can't add structs */

incomplete type at tentative declaration of 'xx'

An incomplete non-static tentative definition has not been completed by the end of the compilation unit. Example:

int incomplete[];
/* should be completed with a declaration like: */
/* int incomplete[SOMESIZE];                    */

junk after #if <expression>
junk after #include "xx"
junk after #include <xx>

None of these directives should have any other non-whitespace characters following the expression/filename. Example:

#include <stdio.h> this isn't allowed

label 'xx' has not been set

An attempt has been made to use a label that has not been declared in the current scope, after having been referenced in a goto statement. Example:

int main(void)
  goto end;

misplaced '{' at top level - ignoring block

{ } blocks can only occur within function definitions. Example:

/* need a function name here */
  int i;

misplaced 'else' ignored

An else with no matching if was found. Example:

if (cc) /* should have used { } */
  i = 1;
  j =2;
  k = 3;

misplaced preprocessor character 'xx'

Usually a typing error; one of the characters used by the preprocessor was detected out of context. Example:

char #str[] = "string"; /* should be char *str[] */

missing #endif at EOF

A #if or #ifdef was still active at end of the source file. These directives must always be matched with a #endif.

missing '"' in pre-processor command line

A line such as #include "name has the second " missing.

missing ')' after xx(... on line nn

The closing bracket (or comma separating the arguments) of a macro call was omitted. Example:

#define rdch(p) {ch=*p++;}
  rdch(p /* missing ) */

missing ',' or ')' after #define xx(...

One of the above characters was omitted after an identifier in the macro parameter list. Example:

#define rdch(p {ch = *p++;}

missing '<' or '"' after #include

A #include filename should be within either double quotes or angled brackets.

missing hex digit(s) after \x

The string escape \x is intended to be used to insert characters in a string using their hexadecimal values, but was incorrectly used here. It should be followed by between one and three hexadecimal digits. Example:

printf("\xxx/"); /* probably meant "\\xxx/" */

missing identifier after #define
missing identifier after #ifdef
missing identifier after #undef

Each of these directives should be followed by a valid C identifier. Example:

#define @ at

missing parameter name in #define xx(...

No identifier was found after a , in a macro parameter list. Example:

#define rdch(p,) {ch=*p++;}

no ')' after #if defined (...

The defined operator expects an identifier, optionally enclosed within brackets. Example:

#if defined(debug

no identifier after #if defined

See above.

non static address 'xx' in pointer initialiser

An attempt was made to take the address of an automatic variable in an expression used to initialise a static pointer. Such addresses are not known at compile-time. Example:

  int i;
  static int *ip = &i; /*&i not known to compiler*/

non-formal 'xx' in parameter-type-specifier

A parameter name used to declare the parameter types did not actually occur in the parameter list of the function. Example:

void fn(a)
int a,b;

number nn too large for 32-bit implementation

An integer constant was found which was too large to fit in a 32 bit int. Example:

static int mask = 0x800000000; /*0x80000000 intended?*/

objects or arrays of type void are illegal

void is not a valid data type.

overlarge floating point value found
overlarge (single precision) floating point value found

A floating point constant has been found which is so large that it will not fit in a floating point variable. Examples:

float f = 1e40; /* largest is approx 1e38 for float */
double d = 1e310; /* and 1e308 for double */

quote (" or ') inserted before newline

Strings and character constants are not allowed to contain unescaped newline characters. Use \<nl> to allow strings to span lines. Example:

printf("Total =

re-using 'struct' tag 'xx' as 'union' tag

There are conflicting definitions of the type struct xx {...} ; and union xx {...} ;. Structure and union tags currently share the same name-space in C. Example:

struct s {int a,b;};
union s (int a; double d;};

re-using 'union' tag 'xx' as 'struct' tag

As above.

size of struct 'xx' needed but not yet defined

An operation requires knowledge of the size of the struct, but this was not defined. This error is likely to accompany others. Example:

  struct s;     /* forward declaration */
  struct s *sp; /* pointer to s */
  sp++;         /* need size for inc operation */

size of union 'xx' needed but not yet defined

See above.

storage class 'xx' incompatible with 'xx' - ignored

An attempt was made to declare a variable with conflicting storage classes. Example:

  static auto int i; /* contradiction in terms */

storage class 'xx' not permitted in context xx - ignored

An attempt was made to declare a variable whose storage class conflicted with its position in the program. Examples:

register int i; /* can't have top-level regs */
void fn(a)
static int a; /* or static parameters */

struct 'xx' must be defined for (static) variable declaration

Before you can declare a static structure variable, that structure type must have been defined. This is so the compiler knows how much storage to reserve for it. Examples:

static struct s s1; /* s not defined */
struct t;
static struct t t1; /* t not defined */

struct/union 'xx' not yet defined - cannot be selected from

The structure or union type used as the left operand of a . or -> operator has not yet been defined so the field names are not known. Example:

  struct s s1; /* forward reference          */
  s1.a = 12;   /* don't know field names yet */

too few arguments to macro xx(... on line nn
too many arguments to macro xx(... on line nn

The number of arguments used in the invocation of a macro must match exactly the number used when it was defined. Example:

#define rdch(ch,p) while((ch = *p++)==' ');
  rdch(ptr); /* need ptr and ch */

too many initialisers in {} for aggregate

The list of constants in a static array or structure initialiser exceeded the number of elements/fields for the type involved. Example:

static int powers[8] = {0,1,2,4,8,16,32,64,128};

type 'xx' inconsistent with 'xx'
type disagreement for 'xx'

Conflicting types were encountered in function declaration (prototype) and its definition. Example:

void fn(int);
int fn(int a)

A pernicious error of this type is caused by mixing ANSI and old-style function declarations. Example:

int f(char x);
int f(x)char x;

typedef name 'xx' used in expression context

A typedef name was used as a variable name. Example:

typedef char flag;
  int i = flag;

undefined struct/union 'xx' cannot be member

A struct/union not already defined cannot be a member of another struct/union. In particular this means that a struct/union cannot be a member of itself: use pointers for this. Example:

struct s1 {
  struct s2 type; /* s2 not defined yet */
  int count;

unknown preprocessor directive : #xx

The identifier following a # did not correspond to any of the recognised pre-processor directives. Example:

#asm /* not an ANSI directive */

uninitialised static [] arrays illegal

Static [] arrays must be initialised to allow the compiler to determine their size. Example:

static char str[]; /* needs {} initialiser */

union 'xx' must be defined for (static) variable declaration

Before you can declare a static union variable, that union type must have been defined. Example:

static union u u1; /* compiler can't ascertain size */

'while' expected after 'do' - found 'xx'

The syntax of the do statement is do statement while (expression). Example:

do /* should put these statements in {} */
  l = inputLine();
  err = processLine(l);/*finds err, not while */
while (!err);

Fatal errors

These are causes for the compiler to give up compilation. Error messages are issued and the compiler stops.

couldn't create object file 'file'

The compiler was unable to open or write to the specified output code file, perhaps because it was locked or the o directory does not exist.

macro args too long

Grossly over-long macro arguments, possibly as a result of some other error.

macro expansion buffer overflow

Grossly over-complicated macros were used, possibly as a result of some other error.

no store left
out of store (in cc_alloc)

The compiler has run out of memory - either shorten your source programs, or free some RAM by, for example, quitting some other applications.

If running under the desktop, you can use the Task Manager to increase your wimpslot size.

too many errors

More than 100 serious errors were detected.

too many file names

An attempt was made to compile too many files at once. 25 is the maximum that will be accepted.

System errors

There are some additional error messages that can be generated by the compiler if it detects errors in the compiler itself. It is very unusual to encounter this type of error. If you do, note the circumstances under which the error was caused and contact your Acorn supplier.

These error messages all look like this:

* The compiler has detected an internal inconsistency. This can occur   *
* because it has run out of a vital resource such as memory or disk     *
* space or because there is a fault in it. If you cannot easily alter   *
* your program to avoid causing this rare failure, please contact your  *
* Acorn dealer. The dealer may be able to help you immediately and will *
* be able to report a suspected compiler fault to Acorn Computers.      *

© 3QD Developments Ltd 2013