Skip to Main Content or Page Contents

C Compiler Error messages

C Programming - List of 'C' Compiler Error messages for the Borland compiler

Tutorial

Results per page:

Match: any search words all search words


Constant expression required

Arrays must be declared with constant size.
This error is commonly caused by misspelling a #define constant.

Could not find file 'filename'

The compiler is unable to find the file supplied on the command line.
Remidy Check if the file exists before trying to use file

Declaration missing ;

Your source file contained a struct or union field declaration that was not followed by a semicolon.
Check previous lines for a missing semicolon.

Declaration syntax error

Your source file contained a declaration that was missing a symbol or had an extra symbol added to it.
Check for
  • A missing semi-colon or parenthesis on that line or on previous lines

Practical Example in Exercise in Tutorial 2


Default outside of switch

The compiler encountered a default statement outside a switch statement.

This is most commonly caused by mismatched braces.

Top of Page


Define directive needs an identifier

The first non-whitespace chr. after a #define must be an identifier. The compiler found some other chr.
See Also Identifier expected

Division by zero

A divide or remainder expression had a literal zero as a divisor.

Example of avoiding this error Tut. 6


do statement must have while

Your source file contained a do ... while statement that was missing the closing while.

do-while statement missing (

In a oo...while statement there is a missing ( bracket. for, if, switch, or while statement, the compiler found no left parenthesis after the while keyword or test expression.


do-while statement missing (

In a do, for, if, switch, or while statement, the compiler found no left parenthesis after the while keyword or test expression.

do-while statement missing OR For statement missing ;

In a do or for statement, the compiler found no semicolon after the right parenthesis.

Top of Page


Duplicate case

Each case of a switch statement must have a unique constant expression value.

Enum syntax error

An enum declaration did not contain a properly formed list of identifiers.

Error directive: 'message'

This message is issued when an #error directive is processed in the source file. 'message' is the text of the #error directive.

Top of Page


Error writing output file

A DOS error that prevents the C++ IDE from writing an .OBJ, .EXE, or temporary file.

Solutions
Make sure that the Output directory in the Directories dialog box is a valid directory.

Check that there is enough free disk space. Delete unneeded files and try again.
Possible faulty disk

Expression syntax

This is a catch-all error message when the compiler parses an expression and encounters a serious error.

Possible Causes

This is most commonly caused by one of the following: two consecutive operators mismatched or missing parentheses a missing semicolon on the previous statement.

Solutions

If the line where the error occurred looks syntactically correct, look at the line directly above for errors.

Try moving the line with the error to a different location in the file and recompiling.

If the error still occurs at the moved statement, the syn tax error is occurring somewhere in that statement.

If the error occurred in another statement, the syn tax error is probably in the surrounding code.

Top of Page


Extra parameter in call

A call to a function, via a pointer defined with a prototype, had too many arguments.

Extra parameter in call to function

A call to the named function (which was defined with a prototype) had too many arguments given in the call.

File name too long

The file name given in an #include directive was too long for the compiler to process. File names in DOS must be no more than 79 chrs long.
In older compilers the MSDOS restiction may apply

for statement missing (

In a for statement, the compiler found no left parenthesis after the while keyword or test expression.

for statement missing )

In a for statement, the compiler found no right parenthesis after the while keyword or test expression.

for statement missing ;

In a forstatement, the compiler found no semicolon after the right parenthesis.

Function call missing ) - Compiler Error

The function call argument list had some sort of syn tax error, such as a missing or mismatched right parenthesis.

Goto statement missing label

The goto keyword must be followed by an identifier.
See Also Identifier expected

Identifier expected

An identifier was expected here, but not found.
In C, an identifier is expected in the following situations:
  • in a list of parameters in an old-style function header
  • after the reserved words struct or union when the braces are not present, and
  • as the name of a member in a structure or union (except for bit fields of width 0).
In C++, an identifier is also expected in these situations:
  • in a list of base classes from which another class is derived, following a double colon (::), and
  • after the reserved word "operator" when no operator symbol is present.

if statement missing (

In a if statement, the compiler found no left parenthesis after the if keyword or test expression.

if statement missing )

In a if statement, the compiler found no right parenthesis after the if keyword or test expression.

Illegal character 'character' ('value')

The compiler encountered some invalid chr. in the input file.
The hexadecimal value of the offending chr. is printed.
This can also be caused by extra parameters passed to a function macro.

Top of Page


Illegal initialization

Initializations must be one of the following:
  • constant expressions
  • the address of a global extern or static variable plus or minus a constant

Illegal octal digit

The compiler found an octal constant containing a non-octal digit (8 or 9).

Illegal parameter to _ _emit_ _

There are some restrictions on inserting literal values directly into your code with the __emit__ function.

For example, you cannot give a local variable as a parameter to __emit__.

Illegal pointer subtraction

This is caused by attempting to subtract a pointer from a non-pointer.

Illegal structure operation

Structures can only be used with dot (.), address-of (&) or assignment (=) operators, or be passed to or from a function as parameters.

The compiler encountered a structure being used with some other operator.

Top of Page


Illegal use of floating point

Floating-point operands are not allowed in these operators
  • shift (SHL, SHR)
  • bitwise Boolean (AND, OR, XOR, NOT)
  • conditional (? :) i
  • ndirection (*)
  • certain others
The compiler found a floating-point operand with one of these prohibited operators.

Illegal use of pointer

Pointers can only be used with these operators:
  • addition (+)
  • subtraction (-)
  • assignment (=)
  • comparison (==)
  • indirection (*)
  • arrow (->)
Your source file used a pointer with some other operator.
Example
int main (void)
     {
        char *p;
        p /= 7;     /* ERROR: not allowed  Use of Pointer */
        return 0;
     }

Improper use of typedef 'identifier'

Your source file used a typedef symbol where a variable should appear in an expression.

Check for the declaration of the symbol and possible misspellings.

Inline assembly not allowed

Your source file contains inline assembly language statements and you are compiling it from within the integrated environment.

You must use the BCC command to compile this source file from the DOS command line.

Incompatible type conversion

The cast requested can't be done

Top of Page


Incorrect number format

The compiler encountered a decimal point in a hexadecimal number.

Incorrect use of default

The compiler found no colon after the default keyword.

Invalid indirection

The indirection operator (*) requires a non-void pointer as the operand.
Example
int main (void)
     {
       void *p;
       *p = 10;     /* ERROR: Invalid Indirection */
       return 0;
     }

Invalid macro argument separator

In a macro definition, arguments must be separated by commas.

The compiler encountered some other chr. after an argument name.

This is correct:
#define tri_add(a, b, c) ((a) + (b) + (c))
This is incorrect:
#define tri_add(a b. c) ((a) + (b) + (c))

Invalid pointer addition

Your source file attempted to add two pointers together.

Top of Page

Invalid use of dot

An identifier must immediately follow a period operator (.).

Example
struct foo 
     {
       int x;
       int y;
     }
      p = 0,0;
int main (void)
      {
        p.x++;         /* Correct */
        p.  y++;       /* Error: Invalid use of dot */
        return 0; 
      }


Lvalue required

The left side of an assignment operator must be an addressable expression.
Addressable expressions include the following:
  • numeric or pointer variables
  • structure field references or indirection through a pointer
  • a subscripted arra y element

Macro argument syntax error

An argument in a macro definition must be an identifier.
The compiler encountered some non-identifier chr. where an argument was expected.
See Also Identifier expected

Macro expansion too long

A macro can't expand to more than 4,096 chrs. s.

Top of Page


Misplaced break

The compiler encountered a break statement outside a switch or looping construct.
You can only use break statements inside of switch statements or loops.

Misplaced continue

The compiler encountered a continue statement outside a looping construct.

Misplaced decimal point

The compiler encountered a decimal point in a floating-point constant as part of the exponent.

Misplaced elif directive

The compiler encountered an #elif directive without any matching #if, #ifdef, or #ifndef directive.

Misplaced else

The compiler encountered an else statement without a matching if statement.

Possible Causes
  • An extra "else" statement
  • An extra semicolon
  • Missing braces
  • Some syntax error in a previous "if" statement

Misplaced else directive

The compiler encountered an #else directive without any matching #if, #ifdef, or #ifndef directive.

Misplaced endif directive

The compiler encountered an #endif directive without any matching #if, #ifdef, or #ifndef directive.

Must take address of a memory location

Your source file used the address-of operator (&) with an expression that can't be used that way; for example, a register variable.

No file name ending

The file name in an #include statement was missing the correct closing quote or angle bracket.

Top of Page


Non-portable pointer comparison

(Command-line equivalent for controling display of this warning=-wcpt)

Your source file compared a pointer to a non-pointer other than the constant 0.

You should use a cast to suppress this warning if the comparison is proper.

Default=displayed

Non-portable pointer conversion

(Command-line for controling display=-wrpt)

An implicit conversion between a pointer and an integral type is required, but the types are not the same size.

This can't be done without an explicit cast.

This conversion might not make any sense, so be sure this is what you want to do.

Not an allowed type

Your source file declared some sort of forbidden type; for example, a function returning a function or arra y

Numeric constant too large

/*Bordland */
String and chr. escape sequences larger than hexadecimal or octal 77 can't be generated.
Two-byte chr. constants can be specified by using a second backslash. For example,
\\ represents a two-byte constant. A numeric literal following an escape sequence should be broken up like this:
printf("" "12345");
This prints a carriage return followed by 12345.

/*T223 */
String and chr. escape sequences larger than hexadecimal \xFF or octal \77 can't be generated.
Two-byte chr. constants can be specified by using a second backslash. For example,
\0D\x0A represents a two-byte constant. A numeric literal following an escape sequence should be broken up like this:


following an escape sequence should be broken up like this:
printf("\x0D" "12345");
This prints a carriage return followed by 12345.

Top of Page


Out of memory

The total working storage is exhausted.

This error can occur in the following circumstances:
  • Not enough virtual memory is available for compiling a particular file. In this case, shut down any other concurrent applications. You may also try to re-configure your machine for more available virtual memory, or break up the source file being compiled into smaller separate components. You can also compile the file on a system with more available RAM.
  • The compiler has encountered an exceedingly complex or long expression at the line indicated and has insufficient reserves to parse it. Break the expression down into separate statements.

Pointer to structure required on left side of -> or ->*

Nothing but a pointer is allowed on the left side of the arrow (->) in C or C++.

In C++ a -> operator is allowed.

Side effects are not allowed

Side effects such as assignments, ++, or -- are not allowed in the debugger watch window.

A common error is to use x=y (not allowed) instead of x==y to test the equality of x and y.

Size of 'identifier' is unknown or zero

This identifier was used in a context where its size was needed.

A struct tag might only be declared (the struct not defined yet), or an extern array might be declared without a size.

It's not allowed to have some references to such an item (like sizeof) or to dereference a pointer to this type.

Rearrange your declaration so that the size of 'identifier' is available.

Statement missing ;

The compiler encountered an expression statement without a semicolon following it.

Practical Example in Exercise in Tut. 2

Top of Page


Structure size too large

Your source file declared a structure too large to fit into memory. (64K in ver 4.5)

Subscripting missing ]

This error is generated if any of the following occur:
  • Your source file declared an array in which the bounds were not terminated by a right bracket.
  • The array specifier in an operator is missing a right bracket.
  • The operator [ ] was declared as operator [.
  • A right bracket is missing from a subscripting expression.
Add the bracket or fix the declaration. Check for a missing or extra operator or mismatched parentheses.

Switch missing (

A left parenthesis is missing after switch keyword.

Switch missing )


Too few parameters in call

A call to a function with a prototype (via a function pointer) had too few arguments.

Prototypes require that all parameters be given.

Make certain that your call to a function has the same parameters as the function prototype.

See Also Identifier expected

Top of Page


Too many cases


PFE only
The compiler encountered more than 257 cases in a single switch.

Too many decimal points

The compiler encountered a floating-point constant with more than one decimal point.

Too many default cases

The compiler encountered more than one default statement in a single switch.

Too many error or warning messages

There were more errors or warnings than set in the Options|Settings|Compiler Messages

Too many exponents

The compiler encountered more than one exponent in a floating-point constant

Too many initializers

The compiler encountered more initializers than were allowed by the declaration being initialized.

Too many storage classes in declaration

A declaration can never have more than one storage class, either Auto, Register, Static, or Extern.

Too many types in declaration

A declaration can never have more than one of these basic types: char class int float double struct union enum typedef name

Too much global data defined in file

The sum of the global data declarations exceeds 64K bytes. This includes any data stored in the DGROUP (all global variables, literal strings, and static locals).

Solutions
Check the declarations for any array that might be too large. You can also remove variables from the DGROUP.

Here's how:
  • Declare the variables as automatic. This uses stack space.
  • Dynamically allocate memory from the heap using calloc, malloc, or farmalloc for the variables. This requires the use of pointers.
  • Declare variables with the _far16 keyword. This puts variables in their own far data segment. (Limits you to running one instance of your app under Windows.)
Literal strings are also put in the DGROUP. Get the file farstr.zip from our BBS to extract literal strings into their own segment.

Top of Page


Two consecutive dots

Because an ellipsis contains three dots (...), and a decimal point or member selection operator uses one dot (.), two consecutive dots cannot legally occur in a C program.

Type mismatch in parameter 'parameter'

Type mismatch in parameter 'parameter' in call to 'function'

Your source file declared the function called via a function pointer with a prototype.

However, the named parameter could not be converted to the declared parameter type.

When compiling C++ programs, this message is always preceded by another message that explains the exact reason for the type mismatch.

That other message is usually "Cannot convert 'type1' to 'type2'" but the mismatch might be due to many other reasons.

Type mismatch in parameter 'number' in call to 'function'

Your source file declared the named function with a prototype, and the given parameter number (counting left to right from 1) could not be converted to the declared parameter type.

When compiling C++ programs, this message is always preceded by another message that explains the exact reason for the type mismatch.

That other message is usually "Cannot convert 'type1' to 'type2'", but the mismatch might be due to many other reasons.

Top of Page


Type mismatch in redeclaration of 'identifier'

Your source file redeclared a variable with a different type than was originally declared for the variable.

Possible Causes
This can occur if a function is called and subsequently declared to return something other than an integer.

Solutions
If this has happened, you must declare the function before the first call to it.

Unable to create output file 'filename'

This error occurs if the work disk is full or write protected.

This error also occurs if the output directory does not exist.

Solutions
If the disk is full, try deleting unneeded files and restarting the compilation.

If the disk is write-protected, move the source files to a writable disk and restart the compilation.

Unable to open include file 'filename'

The compiler could not find the named file.

Possible Causes
  • The named file does not exist.
  • An #include file included itself.
  • You do not have FILES set in CONFIG.SYS on your root directory.
Solutions
  • Verify that the named file exists.
  • Set FILES=20 in CONFIG.SYS.

Top of Page


Unable to open input file 'filename'

This error occurs if the source file can't be found.

Check the spelling of the name. Make sure the file is on the specified disk or directory.

Check under Options|Settings|Directories and verify that the proper directory paths are listed. If multiple paths are required, use a semi-colon to separate them, like this:
C:\bc\lib;C:\bc\owl\lib
or
C:\T223\TURBOC\LIB

Undefined label 'identifier'

The named label has a goto in the function, but no label definition.

See Also Identifier expected

Undefined structure 'structure'

(Command-line equivalent for controling display of this warning=-wstu)

The named structure was used in the source file, probably on a pointer to a structure, but had no definition in the source file.

This is probably caused by a misspelled structure name or a missing declaration.

Default=displayed

Top of Page


Undefined symbol 'identifier'

The named identifier has no declaration.

Possible Causes
  • actual declaration of identifier has been commented out.
  • misspelling, either at this point or at the declaration.
  • there was an error in the declaration of the identifier.
Tools to help track down the problem:
  • CPP
  • GREP

Practical Example in Exercise in Tut. 2 (2 examples)

Practical Example in Exercise in Tut. 3


Unexpected end of file in comment started on 'line number'

The source file ended in the middle of a comment. This is normally caused by a missing close of comment (*/).

Unexpected end of file in conditional started on 'line number'

The source file ended before the compiler (or MAKE) encountered #endif.

The #endif either was missing or misspelled.

Every #if statement needs a matching #endif statement.

Top of Page


Unknown preprocessor directive: 'identifier'

The compiler encountered a # character at the beginning of a line. The directive name that followed the # was not one of the following:
define else endif if ifdef ifndef
include line undef      

Unterminated string or character constant

The compiler found no terminating quote after the beginning of a string or chr. constant.
  • Find the end of the string and insert a "

Practical Example in Exercise in Tut. 2


User break

You typed a Ctrl-Break while compiling in the IDE. (This is not an error, just a confirmation.)

while statement missing (

In a while statement, the compiler found no left parenthesis after the while keyword or test expression.

while statement missing )

In a while statement, the compiler found no right parenthesis after the while keyword or test expression.

Wrong number of arguments in call of macro 'macro'

Your source file called the named macro with an incorrect number of arguments.

Top of Page

 


© tutorials4u.com
HTML Tutorial by John McGuinn.