digitalmars.com                        
Last update Sun Mar 4 11:58:07 2018

Compiler Error Messages

This chapter lists and describes the error and warning messages generated by the compiler. Use this reference to: Messages marked C++ are generated only by the C++ compiler dmc.

Messages marked C are generated only by the C compiler dmc.

Messages marked Warning indicate code that may not execute as you expect but that does compile. This appendix lists messages in alphabetical order.

Some descriptions contain a margin note that refers to sections in one of these books; the sections contain information relevant to the cause of the error:

What's in This Chapter

Recognizing Compiler Error Messages

When the compiler encounters a line in source code that it does not understand, it prints that line with a message. For example:
a= b;
^
file.c(15) Error: undefined identifier 'a'
The caret (^) does not indicate what causes a problem but where the compiler recognizes a problem. If the caret points to a macro, try compiling the file using the Show Results of Preprocessor (-e command line option) to see which part of the macro is causing the error.

The message under the caret starts with the name of the file, the line number where the problem occurs, and whether the message is an error or a warning. The rest of the message identifies what the compiler considers as the problem.

Error Message Types

There are seven error message types. Each message usually contains specific information about the problem.

Command line errors

Command line errors result from incorrect command line options or parameters. For a quick way to find an online summary of command line options and parameters, type sc from the DOS prompt.

Lexical errors

Lexical errors occur when the compiler encounters an unidentified or incomplete token. While they do not immediately terminate compilation, lexical errors do prevent the compiler from generating executable code. An error log tracks lexical errors.

Preprocessor errors

Errors can occur in one of the preprocessing directives. While they do not immediately terminate compilation, preprocessor errors can prevent the compiler from generating executable code.

Syntax errors

While they do not immediately terminate compilation, syntax errors can prevent the compiler from generating executable code. The compiler normally lists four errors of the preprocessor, syntax, lexical types before exiting. Use the -x option to let compilation continue to the end of the source file before exiting with an error.

Warnings

Warnings occur when the compiler finds a statement that is legitimate but probably not what you intended. Warnings are not errors and do not terminate compilation or prevent the compiler from generating code.

Fatal errors

Fatal errors immediately terminate compilation. A typical fatal error occurs when the compiler runs out of memory.

Internal errors

Internal errors, a class of fatal error, take the following form:
file/line #
An assertion failure within the compiler generates this type of error. The error number is useful only in designating where in the compiler code the error occurs. The cause of this message may be an error in source code that the compiler cannot handle intelligently or a bug in the compiler itself. If your code generates this type of error, report it to Digital Mars, even if your code causes the error. Reporting the problem enables Digital Mars to improve error reporting in future releases.

How to report an internal error

Before reporting an internal error to technical support, try to isolate the error in a small program fragment. Use the following procedure:
  1. Place all included code into the main program body using the -e -l options on the command line.
  2. Turn on the -v option for the compiler. This lets you determine which function causes the problem.
  3. Find the approximate cause of the error by backtracking and removing excess code to isolate a short program that demonstrates the fault.
  4. Use mnemonic names for objects and variables in the sample code. Code containing class Base rather than class Hyperxytrisms59 is much easier for the technical support staff to understand.
  5. If applicable, put the offending code in an #ifdef BUG .. #endif block.
  6. Write a comment header with the following information: your name, telephone number, address, version of compiler and linker as well as any other software involved, the nature of the problem, and any other relevant details.
A short bug report lets the technical support staff quickly find the problem.

C and C++ Compiler Error Messages

This is a list of error messages the compiler may generate. Remember, only the C++ compiler generates messages marked C++ and only the C compiler generates messages marked C. Only the Inline Assembler generates messages marked Inline Assembler.
'identifier' is a member of 'identifier' and 'identifier'
Inline Assembler. The member appears in more than one struct; you need to specify which is correct.
'identifier' is a pure virtual function
C++. The compiler cannot directly call a pure virtual function.
'identifier' is already defined
The object is already declared.
'identifier' is a virtual base class of 'identifier'
C++. You cannot convert a pointer to a virtual base class into a pointer to a class derived from it. Also, you cannot create a pointer to a member of a virtual base class. For example:
class virtual_class
{ public:
   int x;
};

class sub_class : virtual public virtual_class { };

void main()
{
  virtual_class *v;
  sub_class *s;
  int virtual_class::*i;
  s = (sub_class *) v;  // error
  i = &sub_class::x;
}
'identifier' is far
C++. A near reference cannot apply to far data.
'identifier' is not a class template
C++. The compiler expects to find the name of a class template but doesn't find one. If you are declaring a template member function, make sure the function's class name is a template. If you use a type of the form foo< bar>, make sure you declare as a template the class name before the less-than sign.
'identifier' is not a constructor
C++. You can use a member initialization list only when you're defining base constructors and member initializers. For example:
struct base { base(int); };
struct other { other(int); };

class sub : base
{ sub(int);  // A constructor.
  sub2(int); // Just a method.
  other o;
};

sub::sub(int a) : o(a), base(a) { }// OK
sub::sub2(int a): o(a), base(a) { }// ERROR
See ARM 12.6.2 for more information.
'identifier' is not a correct struct
union or enum tag identifier, The struct, union, or enum includes invalid characters or is already defined.
'identifier' is not a member of enum 'identifier'
member identifier is not a member of this enum. Make sure to correctly spell the member name and that the member actually belongs to the enum with which you're using it.
'identifier' is not a member of struct 'identifier'
The member identifier is not a member of this class, struct or union. Make sure to correctly spell the member name and that the member actually belongs to the struct with which you're using it. If the member is for a different struct but you want to use it with this struct anyway, cast the struct. Also check for a class member function that is forward referenced. For example:
class X; // Forward reference
class Y { // Declaration
  void g();
  /* . . . */
};
class Z {
  friend void X::f(); // ERROR
  friend void Y::g(); // OK
};
See ARM 11.4 for more information
'identifier' is not a member of forward referenced struct 'identifier'
You need to define a struct before referencing its members.
'identifier' is not a struct or a class
C++. You can derive new classes only from a class or a struct. It is not possible, for instance, to derive a class from a union.
'identifier' is not in function parameter list
The parameter identifier is not listed as a parameter to the function in the function definition.
'identifier' is not a variable
The identifier is not declared as a variable. Make sure you spell the name correctly.
'identifier' must be a base class
C++. When naming a member of a base class in a derived class declaration, qualify the member with a base class identifier. For example:
class other;
class base
{
  private: /* . . . */
};
class sub : base
{ public:
    other::a; // ERROR: other must be a
    /* ... */ // base class of sub.
};
'identifier' must be a class name preceding '::'
C++. The identifier before the double colon operator must be either a class, a struct, or a union.
'identifier' must be a public base class of 'identifier'
C++. When you use the syntax p->class::member, class must be a public base class member of the class to which p is referring. For example:
class public_base
{ public:
    int x;
};

class other_class
{ public:
    int z;
};

class sub : public public_base
{ /* ... */
};

void main()
{
  sub *s;
  s->public_base::x = 1; // OK
  s->other_class::z = 1; // ERROR
}
'identifier' previously declared as something else
You previously declared the identifier as another type. For example, you may have used a function without declaring it, so the compiler automatically declares it as a function returning an int. Now you declare that function to be something else.
identifier storage class is illegal in this context
Check for one of the following:
  • You declared a template outside the global scope.
  • You declared a function argument static or extern.
  • You used an auto or register variable with global scope.
register int global;    // ERROR: Can't declare global
                        // variable as register.
void f()
{
  template<class T> T ave(T* a, int size)
  {
    // ERROR: Can't declare template // in a function.
  }
  /* ... */
}
See ARM 14.1 for more information.
number actual arguments expected for identifier
had number, Warning. The compiler expects a different number of arguments for the function or template. You may be incorrectly using the function, or you may be calling a function with a variable number of arguments without including its header file.
number exceeds maximum of number parameters
The compiler does not support macros with more than 251 parameters.
number operands expected for the identifier instruction
Inline Assembler. The instruction includes an incorrect number of operands.
':' expected
The compiler expects a colon after a constant expression in a case statement and after the keywords public, private, and protected in a class declaration.
'::' or '(' expected after class 'identifier'
C++. The compiler expects two colons or an open parenthesis after a class name in an expression. Casting, however, does not allow two colons. For example:
class x;
f= *(x*)y;
';' expected
The compiler expects a semicolon at the end of a statement.
'
' expected, Make sure parameters are separated by commas.
']' expected
The compiler expects a close bracket at the end of an array declaration or reference.
'(' expected
The compiler expects the expression after the if, while, or for keywords to be enclosed in parentheses.
')' expected
The compiler expects a set of parentheses to be closed. Check for a pair of mismatched parentheses or a bad expression.
'{' expected
The compiler expects an open brace.
'}' expected
The compiler expects a close brace.
'{' or tag identifier expected
The compiler expects a tag name or an open brace to follow the keywords struct, class, union, and enum.
'='
';' or ',' expected, A variable is declared incorrectly. A declaration, must include an equals sign, a semicolon, or a comma after the variable name.
// comments are not ANSI C
C. The Enforce ANSI Compatibility option in the IDDE (the -A command line option) is on, but the program is using C++ style comments. C++-style comments begin with two slashes.
## cannot appear at beginning or end
The double-number sign operator cannot appear at the beginning or end of a list of tokens. The operator must be between two tokens. For example, a ## b.

See ANSI 3.8.3.3 for more information.

# must be followed by a parameter
The number sign operator must appear only in front of a macro parameter. For example, #c.

See ANSI 3.8.3.2 for more information.

'#else' or '#elif' found without '#if'
More #else or #elif preprocessor directives appear than preceding #if, #ifdef, or #ifndef directives.
'#endif' found without '#if'
More #endif preprocessor directives appear than preceding #if, #ifdef, or #ifndef directives.
#include <typeinfo.h> in order to use RTTI
To compile with run-time type identification, you need to include the <typeinfo.h> header file.
#pragma pack(pop) does not have corresponding push
Every #pragma pack(pop) directive requires a corresponding #pragma pack(push) directive.
'<' expected following cast
C++. A type id enclosed in angle brackets (<>) is expected following static_cast, const_cast, reinterpret_cast, or dynamic_cast.

See ARM 5.2 for more information.

'<' expected following 'identifier'
C++. In a class or function template, the argument list must be between angle brackets.

See ARM 14.1 for more information.

'>' expected
A type id enclosed in angle brackets (<>) is expected following static_cast, const_cast, reinterpret_cast, or dynamic_cast.

See ARM 5.2 for more information.

0 expected
C++. A pure virtual function is declared incorrectly. The following is the syntax for a pure virtual function:
class X
{ virtual pure_virtual_func() = 0; // OK
  /* ... */
};
0 or 1 expected
Only binary digits can follow the characters 0b. No spaces should be between the b and the number.
a '...' handler must be the last one for a try-block
C++. catch(...) must appear as the last catch in a list of catch handlers for a try-block.

See ARM 15.3 for more information.

a catch must follow a try-block
C++. The syntax for a catch is:
try { statements } catch (exception-decl) { statements }
See ARM 15.1 for more information.
access declaration must be in public or protected section
C++. A class member's access can change only if that class member is in a public or protected section. For example:
class base
{   int a;
  public:
    int x;
};

class sub : private base
{   base::a; // ERROR
  public:
    base::x; // OK: x is public
};
a derived class member has the same name identifier
C++. A base member's access cannot change when a derived class defines a member with the same name. For example:
class base
{ public:
    int x, y;
    /* ... */
};

class sub : base
{ public:
    void x();
    base::x; // ERROR: same name as x()
    base::y; // OK
};
See ARM 11.3 for more information.
alignment must be a power of 2
Alignment for structure members must be 1, 2, 4, 8, and so on.
alloca() cannot be used in Windows functions
The alloca() function requires the setup of a special stack frame. That frame conflicts with the stack frames that Windows requires.
already seen initializer for 'identifier'
C++. Either more than one member-initializer for the identifier exists, or more than one initializer for the base class exists. For example:
class base
{ int x;
  base(int);
};

class sub : base
{ base b;
  sub(int);
};

sub::sub(int a) :
    base(a + 1),    // OK
    b(a * 2),       // OK
    base(a - 2)     // ERROR
{
  x = a;
}
ambiguous reference to base class 'identifier'
C++. This class has more than one base class, and it is not clear to which the program is referring.

See ARM 11.3 for more information.

ambiguous reference to function
C++. In calling an overloaded function, more than one definition of the function matches the call. For example:
struct X
{ X(int);
};

struct Y
{ Y(int);
};

void f(X); // f() can take an argument of
void f(Y); // either type X or type Y.

void main()
{
  f(1); // ERROR: Ambiguous,
        // f(X(1)) or f(Y(1))?
  f(X(1)); // OK
  f(Y(1)); // OK
}
ambiguous type conversion
C++. The compiler cannot find an unambiguous type conversion. For example:
struct X
{ operator int();
  operator void*();
};

void main()
{
  X x;
  if (x)
    ; // ERROR
  if ((int) x)
    ; // OK
  if ((void*) x)
    ; // OK
}
argument of type 'identifier' to copy constructor
C++. Copy constructors for class X cannot take an argument of type X. Instead, use the reference to X.

See ARM 12.1 for more information.

argument to postfix ++ or --must be int
C++. Only declarations of the following form can declare overloaded functions for the prefix and postfix operators ++ and --:
operator ++()
operator ++(int)
operator --()
operator --(int)
See ARM 13.4.7 for more information.
array dimension must be > 0
A negative number or zero cannot act as an array dimension when declaring an array.

See ANSI 3.5.4.2 for more information.

array of functions is illegal
An array of pointers to functions, not an array of functions, can be declared. For example, instead of this:
int (x[10])();  // ERROR: an array of functions
// returning int use this:
int (*x[10])(); // OK: an array of pointers to
                // functions returning int
array of functions or refs is illegal
C++. An array of pointers to functions, not an array of functions, can be declared. For example, instead of this:
int (&x[10])(); // ERROR: an array of functions
                // returning int
use this:
int (*x[10])(); // OK: an array of pointers to
                // functions returning int
See ARM 8.4.3 for more information.
array or pointer required before '['
The brackets operator can only follow an array or pointer identifier.
assembler opcode expected
Inline Assembler. If the ASM keyword is being used, an assembler opcode or a label should start each instruction.
assignment to 'this' is obsolete
use X::operator new/delete, Warning. C++. Avoid performing storage management by assigning to this. Instead, overload the operators new and delete. Assigning to this is not part of the latest definition of C++, and future compilers may not support it.
at least one parameter must be a class or a class&
C++. An operator overloaded function that is not a class member must have at least one parameter that is a class or class reference.
bad -D switch
identifier, The command line macro definition is invalid.
bad file name 'filename'
The filename is invalid.
bad member-initializer for 'identifier'
C++. A syntax error exists in the base class initializer for the class identifier. For example:
struct base
{   base(int);
};

struct sub : base
{   sub(int);
    int var;
};

sub::sub(int a) : base(a),, var(a) { } // ERROR: Extra comma
base class 'name' has different ambient memory model
C++. The base class name is declared as __far, and a subclass of name is declared as __near, or visa versa. Change either declaration to match the other.

The following code will cause this error:

class __far base { };

class __near sub : public base { };
binary exponent part required for hex floating constants
The exponent is missing from a hexadecimal floating-point constant. A hexadecimal floating point constant comprises an optional sign, the 0x prefix, a hexadecimal significand, the letter p to indicate the start of the exponent, a binary exponent, and an optional type specifier. These are valid hexadecimal floating-point constants:
0x1.FFFFFEp127f
0x1p-23
-0x1.2ACp+10
C++. A bit field cannot occur in an anonymous union. A named union can have a bit field.
blank arguments are illegal
Arguments are missing from a macro reference that is defined to take them. For example:
#define TWICE(x) (x + x)
TWICE(10) // OK
TWICE() // ERROR
'break' is valid only in a loop or switch
The break statement can occur only within a for, while, switch, or do/ while statement.
can only delete pointers
C++. The delete operator works only on pointers. Use delete on a pointer to an object and not the object itself.
can't assign to const variable
A new value is assigned to a const variable. Remove the assignment or remove the restriction from the variable.
can't build filespec 'filename'
The named file cannot write to disk, probably because the disk is full.
can't declare member of another class identifier
C++. In a class declaration, a class name modifies a member function name. For example:
class X
{ void func_in_X();
};

class Y
{
  void X::func_not_in_X(); // ERROR
  int func_in_Y(); // OK
};
can't handle constructor in this context
C++. It is illegal to have a constructor as a default function parameter. For example:
class X
{ public:
    X(int);
};

void foo(X = X(1)); // ERROR: X(1) is a
                    // constructor.
can't have unnamed bit fields in unions
It is illegal to use an unnamed bit field in a union. Use a named bit field or remove the bit field.
can't open response file
The compiler cannot open the response file specified on the command line. Ensure that the file exists and that the correct path is specified.
can't pass const/volatile object to non-const/volatile member function
C++. An object declared as const or volatile is trying to call a member function that is not. Declare the member function const or volatile, or remove the restriction from the object. For example:
struct A
{   int regular_func();
    int const_func() const;
};

void main()
{
  const A const_obj;
  A regular_obj;

  const_obj.regular_func(); // ERROR
  const_obj.const_func(); // OK
  regular_obj.const_func(); // OK
  regular_obj.regular_func(); // OK
}
can't return arrays
functions or abstract classes, C++. A function cannot return an array, function, or abstract class. However, a function can return a pointer to an array or a pointer to a function. For example:
typedef char ARRAY[256];
ARRAY func_returning_array(); // ERROR
ARRAY *func_returning_ptr_to_array(); // OK
can't take address of register
bit field, constant or string, It is not possible to take the address of a register variable, a bit field in a structure, a constant, or a string. Declare the object differently, or avoid taking its address.
can't take sizeof bit field
It is illegal to use sizeof to determine the size of a bit field member of a struct.
cannot convert identifier* to a private base class identifier*
C++. A pointer to a class X cannot convert to a pointer to a private base class Y unless the current function is a member or a friend of X.
class Y { }:
class X : Y;

void f(void)
{
  class X *Px;
  class Y *Py;
  Py = (class Y *) Px;
}
cannot create instance of abstract class 'identifier'
C++. An abstract class contains at least one pure virtual function by the declaration virtual func() = 0. It is illegal to declare objects of such a class. For example:
class abstract_class
{ public:
    virtual int func() = 0;
    int x, y;
};

class subclass : abstract_class
{ public:
    virtual int func()
    {   return (x* 2); }
    int a, b;
};

void main()
{
  subclass a; // OK
  abstract_class b; // ERROR
  // ...
}
cannot define parameter as extern
Extern is an illegal storage class for a function parameter.
cannot delete pointer to const
C++. It is illegal to use the delete operator on a const pointer. Remove the const casting, or remove the delete.

See ARM 8.5.3 for more information.

cannot find constructor for class matching
C++. The compiler cannot find a constructor that matches the current initializers. Use different initializers. Coerce some initializers so that they match those of a constructor, or define a new constructor. For example:
struct X
{   X(char *);
};

void main()
{
  X a = 1L; // ERROR
  X b = 3.1e20; // ERROR
  X c = "hello"; // OK
}
cannot generate identifier for class 'identifier'
C++. The compiler cannot define a copy constructor (X::X(X&)) for class X or an assignment operator (X& operator=(X&)) for class X for the class. If a class needs these methods, explicitly define them.

The compiler cannot define an assignment operator if one of these conditions is true:

  • The class has a const member or base.
  • The class has a reference member.
  • The class has a member that is an object of a class with a private operator=().
  • The class is derived from a class with a private operator=().
The compiler cannot generate a copy constructor if one of these conditions is true:
  • The class has a member that is an object of a class with a private copy constructor.
  • The class is derived from a class with a private copy constructor.
See ARM 12.1 and 12.8 for more information.
cannot generate template instance from -XI identifier
C++. The compiler cannot generate a template instance from the specifier on the command line. Include the template definition in the program and correctly spell the template instance.
cannot have member initializer for 'identifier'
C++. The constructor initializer can initialize only nonstatic members. See ARM 8.12.6.2 for more information.
cannot implicitly convert
This expression requires the compiler to perform an illegal implicit type conversion. To perform this conversion, explicitly cast the expression.
cannot mix C++ EH with NT structured EH
C++. You need to use one scheme or the other; you cannot mix them.
cannot raise or lower access to base member 'identifier'
C++. Access declarations in a derived class cannot grant or restrict access to an otherwise accessible member of a base class. For example:
class base
{ public:
    int a;
  private:
    int b;
  protected:
    int c;
};

class sub : private base
{ public:
    base::a; // OK
    base::b; // ERROR: can't make b
             // accessible
  protected:
    base::c; // OK
    base::a; // ERROR: can't make a
};           // inaccessible
See ARM 11.3 for more information.
cannot throw object of 'identifier' not of ambient memory model
C++. You cannot throw near classes in large data models; likewise, you cannot throw far classes in small data models.
case number was already used
This value already occurs as a case within the switch statement.
casts and sizeof are illegal in preprocessor expressions
An extension to ANSI C allows the use of the sizeof operator and performs a cast in preprocessor directives. Turning on the Enforce ANSI Compatibility option in the IDDE (the -A command line option), disallows use of these expressions in a preprocessor directive.

See ARM 15.3 for more information.

catch type masked by previous catch
C++. One of the following has occurred:
  • The catch type appears more than once.
  • A base class appears before a derived class.
  • A pointer or reference to a base class appears before a pointer or reference to a derived class.
class name identifier expected after ~
C++. A destructor is declared incorrectly. The proper name is class::~class(). If the class is named X, its destructor is X::~X().
code segment too large
The size of the code segment exceeds 64K bytes.
comma not allowed in constant expression
It is illegal to use a comma in a constant expression or to separate numbers by commas or spaces.

See ANSI 3.4 for more information.

comments do not nest
Warning. Avoid nesting comments; it's easy to nest incorrectly and accidentally comment out the wrong code. Instead, use #if 0 and #endif to block out sections of code. Avoid crossing existing #if. For example, the following statements comment out the enclosed code:
#if
  ....
#endif
compile all files with -EH to support exception handling
All code that handles exceptions must be compiled with -EH.
compile all files with -ER to support RTTI
To support run-time type identification, compile all files in the project with -ER.
const or reference 'identifier' needs initializer
Nonextern consts or references must be initialized.

See ANSI 3.4 for more information.

constant expression does not fit in switch type
The value of a case is larger than the type of the switch expression. This error occurs, for example, if a 100000 was assigned to a short value.
constant initializer expected
When initializing a variable being declared, any nonpointer type initializer must be either a constant or the address of a previously declared static or extern item. For example:
const float pi = 3.1415;
float a = 3.0;
static float b;
float w = a * 2; // ERROR: a isn't const float
x = pi * pi; // OK: pi declared const
float *y = &a; // ERROR: a isn't static
float *z = &b; // OK: b is static
'continue' is valid only in a loop
A continue statement occurs out of context. Use it only within for, while, and do/while statements.
conversion of int to far or handle pointer
In this expression, the compiler needs to convert an integer to a far or handle pointer. This conversion probably means that a function that is not declared as a function returns a pointer. The compiler assumes the function returns an integer. For example:
float __far *f();
void main()
{
  float __far *a, *b;
  a = g();    // ERROR: g() not declared, so
              // compiler assumes it returns
              // int, not float *.
  b = f();    // OK: f() declared as function
              // returning float *
}
If the function is declared a function and the conversion is desired, cast the integer to a long integer and then to a pointer, for example:
float far *ptr;
int f();

ptr = f();
float far * // EROR ptr = ()
f(); // OK
data or code defined in precompiled header
Precompiled headers can contain only declarations, not definitions.
declarator for 0 sized bit field
A bit field must have a size.
'default:' is already used
The default: statement appears more than once in a switch statement.
different configuration for precompiled header
The precompiled header being used is precompiled with different options. Precompile the header again with the current options or check the current options for accuracy.
divide by 0
A constant expression tries to divide by zero or use modulo (%) of zero.
duplicate direct base class 'identifier'
C++. When declaring a new class, the same class occurs more than once in its list of direct base classes.

See ARM 10.1 for more information.

DS is not equal to DGROUP
Warning. You have used the -W (Windows target) compiler option with the b modifier (assume DS != DGROUP), and a segment fixup was made to DGROUP.
duplicate file names 'filename'
While compiling files, the compiler tries to open the same list (.lst) or dump file (.dmp) in two places. It is illegal to refer to the same file in both the command line and source code. It is also illegal to use the same file for different outputs, such as .obj, .lst.
empty declaration
A declaration must declare at least a declarator, a tag, or the members of an enumeration.

See ANSI 3.5 for more information.

end of file found before '#endif'
Missing #endif causes the compiler to reach the end of the file in the middle of a conditional compilation statement list.
end of file found before end of comment
line number, A missing */ causes the compiler to reach the end of the file in the middle of a comment.
end of line expected
Using the Enforce ANSI Compatibility option in the IDDE (the -A command line option) does not allow any text to follow the #endif keyword, unless the text is a comment. For example:
#ifdef DEBUG
  printf("oops\n");
#endif DEBUG // Not ANSI-compatible
#ifdef DEBUG
  printf("oops\n");
#endif  // DEBUG
      // ANSI-compatible
error writing output file
The compiler cannot write an output file, probably because the disk is full.
exception specifications must match exactly for each declaration of a function
C++. For example:
void func() throw(int);
void func() throw(unsigned); // ERROR
See ARM 15.4 for more information.
expected assembler directive PTR to follow assembler cast
Inline Assembler. An assembler cast requires the word PTR. For example:
unsigned long 1;
asm {
  mov AX,word PTR ;OK
  mov AX, word 1 ;ERR
}
expected data def of 'identifier'
not func def, It is illegal to declare nested functions in C or C++. For example:
void f()
{
  void g() { } // ERROR: Nested
}              // function.
exponent expected
The compiler cannot find the exponent for the floating point number written. Do not put any white space between the e and the following exponent.
expression expected
The compiler expects to find an expression but cannot find one. A semicolon or a close brace may cause this problem.
expression must be a pointer
C++. The expression:
dynamic_cast <type-name> (expression)
must be a pointer.

See ARM 5.2.6 for more information.

expression must be a pointer or reference to a polymorphic type
C++. This message indicates an invalid use of dynamic_cast. (A polymorphic type is a class with at least one virtual function.)

See ARM 5.2.6 for more information.

external with block scope cannot have initializer
It is illegal to initialize a variable declared extern. Instead, initialize the variable in the file where it is defined.

See ANSI 3.5.7 for more information.

'_far16' is only valid in -mf memory model
The _far16 type modifier is only valid when compiling for the OS/2 2.0 (Flat) memory model.
'_far16' functions can only be extern
The compiler cannot generate code for a _far16 function body; it can only call it.
field 'identifier' must be of integral type
An inappropriate type occurs for a member of a bit field structure. Use signed/unsigned char, short, int, or long.
filespec string expected
The compiler cannot find the filename string in an #include statement. Enclose the filename in double quotes or angle brackets.
__finally or __except expected
C++. For Structured Exception Handling, __finally or __except must be part of the syntax for a __try block.
forward referenced class 'identifier' cannot be a base class
C++. A class must be declared before it can be used as a base class for a new class. A forward declaration is not sufficient. For example:
class A; // Forward reference for A
class B { // Declaration of B
  int a, b, c;
  void f();
};

class X : A { /*...*/ };// ERROR: A isn't
                        // declared

class Y : B { /*...*/ };// OK: B is
                        // declared
function 'identifier' can't be in an anonymous union
C++. An anonymous union cannot have function members.

See ARM 9.6 for more information.

function member 'identifier' has no prototype
The compiler cannot find a function prototype for this function. The C++ compiler requires function prototypes by default. With C, this message occurs only when the -r option is selected.
function 'identifier' is too complicated to inline
Warning. A function declared as inline is too complex to compile inline, so the compiler compiles it as a normal function.
function definition must have explicit parameter list
A function definition requires an explicit parameter list. It cannot inherit a parameter list from a typedef. For example, this definition does not compile:
typedef int functype(int q, int r);
functype funky  // ERROR: No explicit
{               // parameter list
  return q + r;
}
See ANSI 3.7.1 for more information.
function expected
The compiler expects to find a function declaration but does not. Check for mismatched braces, parentheses not preceded by a function name, or a template declaration not followed by a class or function declaration.
functions can't return arrays or functions
C. A function cannot return an array or a function. However, a function can return a pointer to an array or a pointer to a function. For example:
typedef char ARRAY[256];
ARRAY func_returning_array(); // ERROR
ARRAY *func_returning_ptr_to_array(); // OK
GetExceptionCode() only valid in exception filter or handler
C++. GetExceptionCode() is part of Structured Exception Handling.
GetExceptionInformation() only valid in exception filter
C++. GetExceptionInformation() is part of Structured Exception Handling.
global anonymous unions must be static
C++. Anonymous unions must be extern or static.

See ARM 9.5 for more information.

hex digit expected
The compiler expects to find a hexadecimal digit after the characters 0x. Do not put any white space after the x.
identifier expected
The compiler expects to find an identifier, but finds instead another token.
identifier found in abstract declarator
A type in a sizeof expression, typedef statement, or similar place incorrectly includes a variable name. For example:
x = sizeof(int a[3]);   // ERROR: a is a variable
                        // name.
x = sizeof(int[3]);     // OK
identifier is longer than 254 chars
The maximum size of an identifier is 254 characters.
identifier or '(declarator) ' expected
The compiler expects to find a declaration for a static variable, an external variable, or a function. If this error appears in a function, check to see if there are more left braces than right braces.
illegal addressing mode
Inline Assembler. An illegal operand, such as [ah], appears.
illegal cast
It is illegal to cast an object to an inappropriate type. For example, structs or unions cannot cast to other types but can cast numerical values and pointers.
illegal character
ascii number decimal, The source file includes a character, such as @ or $, that is not part of the C character set outside a comment or a string.
illegal combination of types
Certain types cannot occur together. For example, you cannot:
  • Use near and far in the same declaration.
  • Use a modifier on a reference.
  • Use pascal on a pointer.
  • Have a stack pointer to a function.
  • Declare a variable to be a short long int.
illegal constuctor or destructor declaration
C++. A constructor or destructor is incorrectly declared. For example, a constructor may be declared as virtual or friend, a destructor may be declared as friend, or a return value may be specified for a constructor or destructor.
illegal operand
Inline Assembler. The inline assembler cannot evaluate an expression, such as when adding two vars:
dec a + b
Inline assembler operands must be representable in one instruction.
illegal operand types
The operands are of the wrong type, casting the operands to a different type.
illegal pointer arithmetic
The only legal operations on pointers are adding or subtracting an integer from a pointer; subtracting a pointer from another pointer; and comparing two pointers with <, >, ==, <=, or >=.
illegal return type for operator->()
C++. operator->() must return one of these:
  • A pointer to an object of the class that defines operator->()
  • A pointer to an object of another class that defines operator->()
  • A reference to an object of another class that defines operator->()
  • An object of another class that defines operator->()
See ARM 13.4.6 for more information.
illegal type combination
possible missing ';' after struct, You may have omitted a semicolon (;) after a struct declaration.
illegal type for 'identifier' member
Variables cannot be of type void.
struct X
{ void var; // ERROR
};
illegal type/size of operands for the identifier instruction
Inline Assembler Warning. An operand for an instruction is specified as the wrong size. This can be a warning or an error. The following example generates an error; it is illegal because the PUSH instruction does not allow for an 8-bit operand:
char c;
__asm push c;
On the other hand, this is a warning:
mov AX, c
It moves 16 bits from c.

This can also happen for the following FPU instruction format, which is accepted by other compilers:

fmul st(0)
Rewrite it as:
fmul st, st(0)
implied return at closing '}' does not return value
Warning. A function is declared to return a value, but it returns without specifying one.
initialization of 'identifier' is skipped
A goto or case statement has resulted in an explicit or implicit initialization of a variable being skipped.

See ARM 6.7 for more information.

initializer for static member must be outside of class def
C++. Static class members must initialize outside the class definition. For example:
class A
{ static int a = 5;   // ERROR: Can't initialize static
                      // class var in class def.
  void f();
};

class B
{ static int b;
  void f();
};

int B::b = 6;   // OK: Initialize static class var
                // outside class def.
See ARM 9.4 for more information.
initializer or function body for dllimport not allowed
Functions or data objects you declare with the dllimport attribute must be extern declarations.
integer constant expression expected
An integer constant expression must occur in case statements; array size declarations; and the #if, #elif, #exit, and #line preprocessor commands.
integral expression expected
An integer type must occur in case statements; in array size declarations; and the #if, #elif, #exit, and #line preprocessor commands.
internal error identifier number
A compiler error has occurred. Please report this error to Digital Mars.
invalid instruction set 'set' for memory model 'model'
You have specified a 16-bit instruction set for a 32-bit memory model.
invalid reference initialization
C++. It is illegal to use invalid reference initialization errors, which result from trying to initialize:
  • A volatile reference to a const.
  • A const reference to a volatile.
  • A plain reference to a const or volatile.
See ARM 8.4.3 for more information.
invalid storage class for friend
C++. Friend functions cannot be virtual.
keyword not supported
Digital Mars C/C++ recognizes but does not support the keyword. Use the int_xxx routines in the function library instead of the __interrupt keyword. This is the only instance of this message.
last line in file had no \n
Compiling with the Enforce ANSI Compatibility option in the IDDE (the -A command line option) on means that the last line of a source file must end with a newline character. A backslash cannot precede the newline.
__leave must be within a __try block
C++. For Structured Exception Handling, __leave must be part of the syntax for a __try block.
line number expected
The line number in the #line directive must be a constant expression.
linkage specs are "C"
"C++", and "Pascal", not "identifier", C++. The compiler supports only the C++, C, and Pascal linkage types.
local class cannot have static data member 'identifier'
C++. A local class (that is, a class declared within a function) cannot have a static data member. For example:
void f()
{
  class local_class
  {   int a, b;
      static int c;   // ERROR: Can't have void g();
                      // static var in
  } l1, l2;           // local class
  // ...
}
See ARM 9.4 for more information.
long long not supported for ANSI or 16 bit compiles
64-bit ints are only supported for 32-bit memory models. The long long data type is not an ANSI standard data type.
lvalue expected
The compiler expects to assign a value to an expression, such as a variable. For example:
short short_f(void);
short *pshort_f(void);

void function(void)
{
  short i;
  short *p = &i;      // Operand of ++ must be an lvalue
  7++;                // NO
  short_f()++;        // NO
  pshort_f()++;       // NO

  // Left operand of an assignment
  // must be an lvalue.
  A, B = i;           // NO
  pshort_f() = i;     // NO
  *pshort_f() = i;    // OK: Produces an lvalue
  (*p)++;             // OK
  (*pshort_f())++;    // OK
}
main()
WinMain(), or LibMain() cannot be static or inline, C++. It is illegal to declare any of the functions main(), WinMain(), or LibMain() as static or inline.

See ARM 3.4 for more information.

maximum width of number bits exceeded
This field can contain number bits. For example:
struct X
{ char x:9;   // ERROR: char is 8 bits
  short y:17; // ERROR: short is 16 bits
  long z:33;  // ERROR: long is 32 bits
};
macro 'identifier' can't be #undef'd or #define'd
It is illegal to redefine or undefine this predefined macro. To suppress non-ANSI predefined macros, set the Suppress Predefined Macros option in the IDDE (the -u command line option).

See ANSI 3.8.8 for more information.

malformed template declaration
C++. A template class or function is declared incorrectly. The following are correct declarations:
template<class T, int x> // OK
class vector
{
    T v[x];
  public:
    vector();
    T& operator[](int);
    /* ... */
};

template<class T> // OK
T ave(T x, T y)
{
    return ((T)((x + y) / 2));
}
See ARM 14 for more information.
maximum length of macro text exceeded
The maximum length of a macro replacement text string has been exceeded.
max of number characters in string exceeded
This string can contain number characters.
member 'identifier' can't be same type as struct 'identifier'
A member of a structure with type identifier cannot itself have type identifier.
member 'identifier' is const but there is no constructor
C++. If a class has a const member, the class must also have a constructor. Initialize a const variable only in the constructor, for example:
class A
{ // ERROR: no constructor
  const int x;        // to initialize x
  int y, z;
  void f();
};

class B
{ const int x;
  int y, z;
  void f();
  B();        // OK: x can be
};              // initialized.
member 'identifier' of class 'identifier' is not accessible
C++. A class member that is private or protected cannot be accessed.
member 'identifier' of class 'identifier' is private
C++. Only a class function or a derived function of the class can use a private member. For example:
class super
{ private:
    int x;
    int f();
};

class sub : super
{
  int g();
};

int super::f()
{
  return (x++);       // OK: B::f() is a
}                     // member function

int sub::g()
{
  return (x++);       // ERROR: sub::g() is a
}                     // member function
                      // of a derived class
void main()
{
  super s;
  s.x = 3;            // ERROR: main() isn't a
  return 0;           // member function
}                     // or a friend
                      // function
missing '
' between declaration of 'identifier' and 'identifier', You probably wrote something like:
int x y;
where x was to be a macro.
missing decl-specifier-seq for declaration of 'identifier'
You can only omit the decl-specifier-seq (the storage class followed by the declaration's type) in function definitions and function declarations.

See ARM 7 for more information.

must be void operator delete(void *[, size_t]);
C++. The improper prototype occurs when the delete operator for a class that uses the C++ model is overloaded. The prototype for an operator delete overload must be either:
void operator delete(void *); // OK
or
void operator delete(void *, size_t);// OK
must use delete[] for arrays
C++. To delete an array a, use this statement:
delete[] a; // OK
and not
delete a; // ERROR
See ARM 5.3.4 for more information.
need at least one external def
There must be at least one global symbol defined.

See ANSI 3.7 for more information.

no constructor allowed for class 'identifier'
C++. The class includes a variable with the same name as the class. This prevents the use of a constructor that must have that name.
no definition for static 'identifier'
A static is referred to, but no definition is provided. For example:
static void f();
void g() { f(); }
See ANSI 3.7 for more information.
no identifier for declarator
An identifier is missing from this declaration. For example:
void f(char [3]) // ERROR: No identifier
{
  // ...
}

int [3]; // ERROR: No identifier
int a[3]; // OK: Identifier is a
no input file specified
This command line must include an input file.
no instance of class 'identifier'
C++. It is illegal to attempt the following:
  • Call a nonstatic member function without using an instance of the class.
  • Access a nonstatic data member without using an instance of the class.
  • Define a nonstatic data member outside a class. However, it is legal to attempt the following:
  • Call a static member function without an object.
  • Access a static data member without an object.
  • Define a static data member outside a class.
For example:
struct CLASS
{
  static void static_func();
  void nonstatic_func();
  static int static_data;
  int nonstatic_data;
};

int CLASS::nonstatic_data = 1; // ERROR
int CLASS::static_data = 1; // OK

void main()
{
  CLASS object;
  int i = CLASS::nonstatic_data;        // ERROR
  int j = object.nonstatic_data;        // OK

  CLASS::nonstatic_func();      // ERROR
  CLASS::static_func(); // OK
  object.nonstatic_func();      // OK
}
no instance of class 'identifier' for member 'identifier'
C++. You attempted to reference a member of a class without a this pointer being available.
no match for function 'identifier'
C++. The function is overloaded, and the compiler cannot find a function that matches the call.
no return value for function 'identifier'
A function has a return type other than void, but it has no return statement or has a path by which it doesn't return. For example:
int f()
{
  if (x)
    return;
}
See ARM 6.6.3 for more information.
no tag name for struct or enum
Warning. If a struct or an enum does not have a tag name, further objects of this type cannot be declared later in the program. Give every struct and enum a tag name so that the compiler's type-safe linkage system can use it.
non-const reference initialized to temporary
Warning. In most cases, this message means that a temporary occurs and the warning initializes the reference to that temporary. Since the reference is not const, the referenced temporary may change its value.

However, this message becomes an error when the Enforce ANSI Compatibility option in the IDDE (the -A command line option) is set.

See ARM 8.4.3 for more information.

not a struct or union type
The type of object preceding the object member operator selector (.) or the pointer to object selection (operator ->) is not a class, a struct, or a union.
not an overloadable operator token
C++. You cannot overload these operators:
. .* :: ?: sizeof # ##
not in a switch statement
It is illegal to use a case or default statement outside a switch statement.
number 'number' is too large
The number is too large to be represented in an object with long type.
number is not representable
The compiler cannot represent a numeric constant because of the constraints listed in the following table:
        You cannot represent:   If it is:

        Integer                 greater than ULONG_MAX (in limits.h)

        Floating point number   less than DBL_MIN or greater than DBL_MAX
        (in float.h)

        Enumeration constant    greater than INT_MAX
        (in limits.h)

        Octal character constant greater than 255
object has 0 size
The compiler does not allow objects of zero size. Trying to subtract two pointers that point to zero size objects causes division by zero.
octal digit expected
The compiler expects that a number with a leading 0 is an octal digit. Using an 8 or 9 is illegal.
one argument req'd for member initializer for 'identifier'
C++. Member initializers in which the member lacks a constructor must have exactly one parameter because the member is initialized by assignment.
only classes and functions can be friends
C++. It is legal to declare other classes or functions friend only when declaring a function within a class.
only one identifier is allowed to appear in a declaration appearing in a conditional expression
C++. Pointers and references to references are invalid. operator functions ->() and [] must be non-static members C++. It is illegal to declare as static these operators:
  • The pointer to object selection operator (->)
  • The function call operator (())
  • The array operator ([])
operator overload must be a function
C++. It is illegal to declare an overloadable operator as a variable. For example:
struct X
{ int operator<<; // ERROR
};
out of memory
The compiler is out of memory. Try the following:
  • Break the file or function into smaller units.
  • If the error occurs while optimizing a function, turn off optimization for that function.
  • Use a DOS-extended version of the compiler, if applicable.
overloaded function 'identifier' has different access levels
C++. It is illegal to adjust the access of an overloaded function that has different access levels. For example:
class base
{
  public:
    void f(int);
  private:
    void f(float);
};

class sub : base {
 base::f;  // ERROR: f() is
};         // overloaded.
See ARM 11.3 for more information.
parameter list is out of context
Parameters in a function definition are illegal and are discarded. For example:
int f(a, b); // ERROR
int g(int, int); // OK
int h(int a, int b); // OK
parameter lists do not match for template 'identifier'
C++. The parameter list for the template instantiation does not match the formal parameter list for the class definition.
template<class T, int size> class vector;
template< class T, unsigned size> class
vector; // no {}
vector<int, 20> x; // OK
vector<float, 3.0> // ERROR: 3.0 is not an int.
pascal string length number is longer than 255
This __pascal string's length exceeds 255 characters.
pointer required before '->'
'->*' or after '*', C++. These operators can apply only to pointers. The operators -> and ->* must precede the pointer, and the operator * must follow it.
pointer required before '->' or after '*'
C. These operators can apply to pointers only. The operator ->must precede the pointer, and the operator * must follow it.
pointer to member expected to right of .* or ->*
C++. The identifier after . or ->* must be a pointer to a member of a class or struct.
possible extraneous ';'
Warning. The compiler finds a semicolon immediately after an if, switch, or while statement and executes the next statement, regardless of whether the test evaluates to true or false. For example:
int x = 1, y = 0;
if (x== y);             // WARNING: Extra
printf("x == y\n");     // semicolon.
printf();               // always executed.
if (x == y) // OK
  printf("x == y\n");
If a semicolon is desired, suppress the warning by putting white space, such as a space or a return, between the close parenthesis and the semicolon.
while (fread(file) == unwanted_data)
    ; // OK: semicolon is intentional
possible unintended assignment
Warning. The assignment operator (=) instead of the equality operator (==) appears in the test condition of an if or while statement. For example:
if (x = y) {...} // WARNING: x= y is an assignment
instead of
if (x == y) {...} // OK: x == y is a test
Test the value of the assignment explicitly, like this:
if ((x = y) != 0) {...} // OK: (x = y) != 0 is a test
The compiler produces identical code for the first and third examples.
pragma cseg must be at global scope
A #pragma cseg statement must occur in the global scope and not within a function body or type definition.
precompiled header compiled with C instead of C++
C++. You have included a C precompiled header in a C++ compilation.
precompiled header compiled with C++ instead of C
C. You have included a C++ precompiled header in a C compilation.
prefix opcode must be followed by an assembler opcode
The opcode must immediately follow the LOCK, REP, REPE, REPNE, or REPZ instruction prefixes.
premature end of source file
A string that is missing a closing quote or a comment that is missing a */ causes the compiler to reach the end of the file while processing a function.
prototype for 'identifier' should be identifier
A function of the form: func(s) short s; { ... } should be prototyped as:
func(int s);
rather than:
func(short s);
See ANSI 3.5.4.3 for more information.
pure function must be virtual
C++. Pure member functions must be declared as virtual, like this:
class B
{ virtual void f() = 0; // OK
  void g() = 0;         // ERROR
};
qualifier or type in access declaration
C++. It is illegal to specify a storage class or type when adjusting the access to a member of a base class. For example:
class base
{ public:
  int b, c, d;
  int bf();
};

class sub : private base
{ int e;
 public:
  base::b; // OK
  int base::c; // ERROR
  static base::d; // ERROR
};
See ARM 11.3 for more information.
recursive prototype
turn off autoprototyping, Use the -p compiler option (see Compiling Code) to turn off autoprototyping.
redefinition of default parameter
C++. It is illegal to redefine the default argument for a parameter even if redefined to the same value. For example:
// Prototyping the function.
int f(int, int = 0);

// Defining the function.
int f(int a, int b = 0) // ERROR: Can't
{                       // redefine default
  return g(a, b);       // argument, even to
}                       // the same value.
The line given for the error is sometimes past the closing brace of the body of the function.
reference to 'identifier' caused a 386 instruction to be generated
Inline Assembler Warning. This warning occurs when not using 32- bit compilation when a reference to a variable causes a 32-bit mode instruction to generate, such as:
unsigned long UL;
ASM {
  INC UL // incrementing a long is 32 bit
}
reference must refer to same type or be const
When initializing a reference, the object being used as an initializer must be of the same type as the reference, or it must have const type.
return type cannot be specified for conversion function
C++. It is illegal to specify the return type of a conversion function. For example:
class X
{ char* operator char* (); // ERROR
  operator char* (); // OK
};
See ARM 12.3.2 for more information.
returning address of automatic 'identifier'
Warning. This results in an invalid pointer beyond the end of the stack. When the function returns, the caller receives an illegal address that can cause a general protection fault.
segment size is number
exceeding 64KB, Code and data for 16-bit compilations are output into 64KB segments, one of which exceeds 64KB. This can happen when declaring objects whose combination is larger than 64KB. For example: int a[50000]. Divide the source module into smaller pieces, or switch to a 32-bit memory model.
should be number parameter(s) for operator
C++. The incorrect number of arguments appears in a declaration of an overloaded operator. The function call operator () is n-ary; it can take any number of arguments.
size of identifier is not known
It is illegal to use a struct or an array with an undefined size. For example:
struct x
{ int a[]; // ERROR
  /* ... */
};

struct y
{ int a[100]; // OK
  /* ... */
};
size of type exceeds 64KB
Data objects in 16-bit memory models cannot exceed 64KB unless declared with the _huge modifier.
statement expected
The compiler expects a statement but does not encounter one. A missing comma or semicolon or a label without a statement can cause this error. For example:
while (TRUE)
{   // ...
    if (done)
      goto end1;
    // ...
  end1:
} // ERROR: No statement after
  // label.

while (TRUE)
{ // ...
  if (done)
    goto end2;
  // ...
end2: ; // OK: Null statement after label.
}
static function 'identifier' can't be virtual
You cannot mix static and virtual storage classes for member functions. (Note that the operators new() and delete() are static.)
static or non-member functions can't be const or volatile
C++. It is illegal to declare a static class member function or a nonmember class function as const or volatile.
static variables in inline functions not allowed
C++. It is illegal to declare a static variable within an inline function.
storage class for 'identifier' can't be both extern and inline
C++. It is illegal to use the inline type specifier for a function declared external.
string expected
The compiler expects to encounter a string but cannot find one. Check for an #ident directive not followed by a string.
struct-declaration-list can't be empty
C. A struct must contain at least one member.

See ANSI 3.5.2.1 for more information.

template-argument 'identifier' must be a type-argument
C++. In a function template, all template arguments must be type arguments. Unlike class templates, function templates cannot have expression arguments. For example:
template <class T, int x> foo(T y)
    // ERROR: x is an expression argument.
{   return x + y;
}
See ARM 14.4 for more information.
template-argument 'identifier' not used in function parameter types
C++. When defining a template, every template argument in the template's argument list must appear in the function's argument list. For example:
template <class T1, class T2>
int bar(T1 x)   // ERROR: T2 isn't in
{ // function's
  T2 y; // argument list.
  // ...
}
See ARM 14.4 for more information.
too many errors
The compiler has reached its limit of four errors. For the compiler to continue past its limit, set the Turn Off Error Maximum option in the Compiler Output dialog box in the IDDE (the -x command line option).
too many initializers
The item contains too many initializers. For example:
char a[3]="hello";      // ERROR
char b[3]="hi!";        // ERROR: No room for
                        // null character
char c[3]="hi";         // OK
trailing parameters must have initializers
C++. Parameters with default initializers must occur at the end of a parameter list. For example:
int f(int, int= 1, int = 0); // OK
int g(int = 0, int = 1, int); // ERROR
int h(int = 0, int, int = 1); // ERROR
__try only valid for -mn memory model
Code that uses the __try modifier must be compiled for the Windows NT memory model.
type conversions must be members
C++. It is illegal to declare a type conversion function outside a class. Declare it inside a class.
type is too complex
C++. The compiler appends information regarding parameter and return types to the end of a function name. With this information added, the identifier exceeds the compiler's maximum of 254 characters.
type mismatch
This error is either a syntax error or a warning message. The compiler expects to find one data type but finds another. More information about which types it expects and what it finds follows this message.
type must be a pointer or a reference to a defined class or void*
This message refers to the type specified in a dynamic_cast.
type must be void *operator new(size_t [,..]);
C++. The wrong prototype appears when the new operator for a class that uses the C++ model is overloaded. When operator new is overloaded, it must have a return type of void * and take a first argument of size_t. The compiler automatically sets the value of the first argument to be the class size in bytes.

See ARM 5.2.6 for more information.

type of 'identifier' does not match function prototype
The arguments of the function do not match the prototype previously given.
types may not appear more than once in an exception specification
It is illegal to write an exception specification like:
void func() throw(int, int);
See ARM 15.4 for more information.
unable to open input file 'filename'
The compiler cannot find the file. Correctly spell the name and specify the correct folder.
unable to open output file 'filename'
The compiler cannot open the file. Specify a valid file name and make sure there is enough disk space.
undefined escape sequence
The compiler recognizes only the following escape sequences in a string or character constant:
Table 29-1 Defined escape sequences
sequence Represents
\' single quote
\" double quote
\? question mark
\\ backslash
\a alert (bell)
\b backspace
\f form feed
\n newline
\r return
\t tab
\v vertical tab
\xXXX the character specified with the hexadecimal number
\000 the character with the octal number
undefined identifier 'identifier'
It is illegal to use an identifier without declaring it. Correctly spell the identifier.
undefined label 'identifier'
The goto command to go to a label must be defined. Correctly spell the label and make sure the label appears in the same function as the goto.
undefined tag 'identifier'
The structure or union is not defined.
undefined use of struct or union
It is illegal to use operators, such as arithmetic or comparison operators, that do not apply to structs, classes, or unions.
unknown operand type for this floating point instruction
Inline Assembler. It is illegal to enter an inappropriate operand, such as a numeric constant, on a floating point instruction. For example:
fdiv 0x50
union members cannot have ctors or dtors
C++. A union cannot contain a member that is an object of a class with a constructor or a destructor.
unrecognized pragma
Warning. The compiler does not recognize this #pragma directive. See Digital Mars C++ Language Implementation for a list of valid pragmas.
unrecognized parameter 'identifier'
The compiler does not recognize a parameter or option on the command line. Command line options are case sensitive.
unrecognized preprocessing directive '#identifier'
The compiler does not support the specified preprocessor directive.
unrecognized token
The compiler does not recognize the token as valid. Check for an extra U or L suffix in an integer constant. It is illegal to use $ and @ in identifiers.
unsupported based type
C++. Valid based types are:
__based(__segname("_DATA")) => __near
__based(__segname("_STACK")) => __ss
__based(__segname("_CODE")) => __cs
unsupported __declspec type
Supported __declspec types are:
declspec(dllimport)
declspec(dllexport)
declspec(naked)
declspec(thread)
unterminated macro argument
A macro argument is missing a close quote or parenthesis.
unterminated string
A string is missing a close quote, or a file contains a lone quote mark. The compiler found end of line or end of file before the string terminator.

See ANSI 3.1.3.4 for more information.

use delete[] rather than delete[expr]
expr ignored, Warning. C++. This syntax for deleting an array of objects is outdated, although the current version of the compiler supports it and ignores expr:
delete [expr] p; // WARNING: obsolete
New code uses this syntax instead:
delete [] p; // OK
using operator++() (or --) instead of missing operator++(int)
Warning. C++. It is illegal to use the postfix increment (or decrement) operator on an object of a class, such as x++, without overloading the postfix operator for that class. However, the prefix operator is overloaded. The compiler uses the prefix version of the operator.

To overload the postfix increment operator x++, use operator++(). To overload the prefix increment operator ++ x, use operator++(int).

valid memory models are -m[tsmcrzlvfnpx]
This command line error indicates that the options for memory model selection are incorrect.
value of expression is not used
Warning. It is illegal to compute an expression without using its value, such as the equality operator (==) instead of the assignment operator (=). For example:
x == y; // WARNING: The value of x
        // doesn't change.
x = y;  // OK: x and y have same value.
Failure to assign the result of a computation to a variable can also cause this error. For example:
t - 5;          // WARNING: Result of this
                // computation is lost.
x = t - 5;      // OK: x contains the result.
t -= 5;         // OK: t contains the result.
variable 'identifier' used before set
Warning. The optimizer discovers that a specified variable appears before it is initialized. The program may generate inexplicable results.
vectors cannot have initializers
C++. It is illegal to initialize a vector of objects with a constructor that has an argument list.
very large automatic
Warning. Large automatic variables can cause stack overflow. Dynamically allocate the memory with a function such as malloc().
voids have no value
C. It is illegal to return a value from a function declared void or to use the value of a function declared void.
voids have no value
ctors and dtors have no return value, C++. It is illegal to return a value from a constructor, destructor, or function declared void or a reference to a void. It is also illegal to use the value of a constructor, destructor, or function declared void.
'while' expected
The keyword while is missing from the end of a do/while loop. For example:
do {
  x = f(y);
} (x != 0);     // ERROR: missing while.
do {
  x = f(y);
} while (x != 0); // OK
Home | Runtime Library | IDDE Reference | STL | Search | Download | Forums