Number | Compiler Error Message |
C2000 | UNKNOWN ERROR Contact Microsoft Product Support Services |
The compiler detected an unknown error condition. | |
Note the circumstances of the error and notify Microsoft Corporation by following the instructions in the Microsoft Product Assistance Request form at the back of one of your manuals. | |
C2001 | newline in constant |
A string constant was continued on a second line without either a backslash (\) or closing and opening double quotation marks ("). | |
To break a string constant that is on two lines in the source file, do one of the following:
End the first line with the line-continuation character, a backslash. Close the string on the first line with a double quotation mark, and open the string on the next line with another quotation mark. |
|
It is not sufficient to end the first line with \n, the escape sequence for embedding a newline character in a string constant. | |
The following are examples of incorrect and correct usage:
printf("Hello, // error world"); printf("Hello,\n // error world"); printf("Hello,\ // OK world"); printf("Hello," // OK " world"); |
|
Note that any spaces at the beginning of the next line after a line-continuation character are included in the string constant and that neither solution actually places a newline character into the string constant. The following examples embed this character:
printf("Hello,\n\ world"); printf("Hello,\ \nworld"); printf("Hello,\n" "world"); printf("Hello," "\nworld"); |
|
C2002 | invalid wide-character constant |
The use of the multibyte-character constant was not legal. | |
This error can be caused if a wide character contains more bytes than expected. | |
Wide characters cannot be concatenated with ordinary string literals and cannot be used if the standard header, STDDEF.H, is not included. | |
Wide-character strings and constants must be preceded by the character L. | |
The following example shows a wide-character constant:
L'mbconst' |
|
Wide characters are not supported in C. | |
C2003 | expected defined id |
An identifier was expected after the specified preprocessing keyword. | |
C2004 | expected defined(id) |
An identifier was expected after the left parenthesis following the specified preprocessing keyword. | |
C2005 | #line expected a line number, found token |
A #line directive lacked the required line-number specification. | |
C2006 | #include expected a filename, found token |
An #include directive lacked the required filename specification. | |
C2007 | #define syntax |
An identifier was expected following #define in a preprocessing directive. | |
C2008 | character : unexpected in macro definition |
The given character was found immediately following the name of the macro. | |
C2009 | reuse of macro formal identifier |
The given identifier was used more than once in the formal parameter list of a macro definition. | |
C2010 | character : unexpected in macro formal parameter list |
The given character was used incorrectly in the formal parameter list of a macro definition. | |
C2011 | identifier : type type redefinition |
The specified identifier was already defined as type type. | |
The following is an example of this error:
struct S; union S; |
|
C2012 | missing name following '<' |
An #include directive lacked the required filename specification. | |
C2013 | missing '>' |
The closing angle bracket (>) was missing from a #include directive. | |
C2014 | preprocessor command must start as first nonwhite-space |
Nonwhite-space characters appeared before the number sign (#) of a preprocessor directive on the same line. | |
C2015 | too many characters in constant |
A character constant contained more than two characters. | |
Character constants are limited to one character (standard charcter constants) or two characters (long character constants). | |
Note that an escape sequence (for example, \t for tab) is converted to a single character. | |
C2016 | no closing single quotation mark |
A newline character was found before the closing single quotation mark of a character constant. | |
C2017 | illegal escape sequence |
An escape sequence appeared where one was not expected. | |
An escape sequence (a backslash, \, followed by a number or letter) may occur only in a character or string constant. | |
C2018 | unknown character hexnumber |
The ASCII character corresponding to the given hexadecimal number appeared in the source file but is an illegal character. | |
One possible cause of this error is corruption of the source file. | |
C2019 | expected preprocessor directive, found character |
The given character followed a number sign (#), but it was not the first letter of a preprocessor directive. | |
C2020 | member : class member redefinition |
The specified member of the specified base class or structure was redefined. | |
A function inherited from a base class or structure cannot be redefined. | |
If the function is redefined in the derived class, it should be declared as virtual in the base class. | |
C2021 | expected exponent value, not character |
The given character was used as the exponent of a floating-point constant but was not a valid number. | |
C2022 | number : too big for character |
The octal number following a backslash (\) in a character or string constant was too large to be represented as a character. | |
C2023 | divide by 0 |
The expression resulted in a division by zero. | |
C2024 | mod by 0 |
The expression resulted in a modulo 0 operation. | |
C2025 | identifier : enum/struct/union type redefinition |
The given identifier had already been used for an enumeration, structure, or union tag. | |
C2026 | string too big, trailing characters truncated |
The string was longer than the limit of 2048 characters. | |
After adjacent strings are concatenated, a string cannot be longer than 2048 characters. | |
C2027 | use of undefined type identifier |
The specified type was not defined. | |
A type cannot be used until it is defined. | |
C2028 | struct/union member needs to be inside a struct/union |
Structure or union member must be declared within the structure or union, respectively. | |
C2030 | identifier : struct/union member redefinition |
The identifier was used for more than one member of the same structure or union. | |
C2032 | identifier : function cannot be member of struct/union identifier |
The specified structure or union was declared with a member function. | |
Member functions are allowed in C++ but not in C. | |
C2033 | identifier : bit field cannot have indirection |
The given bit field was declared as a pointer (*), which is not allowed. | |
The following is an example of this error:
struct S { int *b : 1; // error }; |
|
C2034 | identifier : type of bit field too small for number of bits |
The number of bits specified in the bit-field declaration exceeded the number of bits in the given base type. | |
C2036 | identifier class-key : unknown size |
The address of the specified undeclared identifier was used. | |
The size of an undeclared object cannot be used. | |
The following is an example of this error:
struct A* pA; struct B { int i; }; B* pB; void main() { pA++; // error, size of A not known pB++; // OK, B has been declared } |
|
C2037 | left of operator specifies undefined struct/union identifier |
The expression before the member-selection operator ( –> or .) identified a structure or union type that was not defined. | |
C2039 | identifier : not struct/union member |
A nonmember of a structure or union was incorrectly used. | |
The following is an example of this error:
struct S { int mem0; } *pS; void main() { pS->mem1 = 0; // error, mem1 is not a member pS->mem0 = 0; // OK } |
|
C2040 | operator : different levels of indirection |
An expression involving the specified operator had inconsistent levels of indirection. | |
If both operands are of arithmetic type or if both are not (such as array or pointer), then they are used without change. However, the compiler may DS-extend one of the operands if one is __far and the other is __near. If one operand is arithmetic, but the other is not, the arithmetic operator is converted to the type of the other operator. | |
C2041 | illegal digit character for base number |
The specified character was not a legal digit for the base that was used. | |
The following is an example of this error:
int i = 081; // error, 8 is not a legal digit int i = 071; // OK |
|
C2042 | signed/unsigned keywords mutually exclusive |
The keywords signed and unsigned were both used in a single declaration. | |
The following is an example of this error:
unsigned signed int i; // error |
|
C2043 | illegal break |
A break statement is legal only within a do, for, while, or switch statement. | |
C2044 | illegal continue |
A continue statement is legal only within a do, for, or while statement. | |
C2045 | identifier : label redefined |
The label appeared before more than one statement in the same function. | |
C2046 | illegal case |
The keyword case can appear only within a switch statement. | |
C2047 | illegal default |
The keyword default can appear only within a switch statement. | |
C2048 | more than one default |
A switch statement contained more than one default label. | |
C2049 | case value value already used |
The case value was already used in this switch statement. | |
This error can be caused by enumerations or macros that evaluate to the same value. | |
C2050 | nonintegral switch expression |
A switch expression did not evaluate to an integral value. | |
C2051 | case expression not constant |
Case expressions must be integral constants. | |
C2052 | case expression not integral |
Case expressions must be integral constants. | |
C2053 | identifier : wide string mismatch |
The specified wide string was assigned to an incompatible type. | |
The following is an example of this error:
char array[] = L"Rika"; |
|
C2054 | expected '(' to follow identifier |
The context requires parentheses after the function identifier. | |
One cause of this error is omitting an equal sign (=) on a complex initialization, as in:
int array1[] { 1, 2, 3 }; // error, missing = int array2[] = { 1, 2, 3 }; // OK |
|
C2055 | expected formal parameter list, not a type list |
A parameter type list instead of a formal parameter list appeared in a function definition. | |
In ANSI C, the formal parameters in a function definition must all be named unless they are void or an ellipsis (...). | |
C2056 | illegal expression |
An expression was illegal because of a previous error, which may not have produced an error message. | |
C2057 | expected constant expression |
The context requires a constant expression. | |
C2058 | constant expression is not integral |
The context requires an integral constant expression. | |
C2059 | syntax error : token |
The token caused a syntax error. | |
C2060 | syntax error : end of file found |
At least one more token was expected. | |
Causes of this error include omitting a semicolon (;), as in:
int *p // error |
|
or omitting a closing brace (}) from the last function, as in:
main() { // error |
|
C2061 | syntax error : identifier identifier |
The identifier caused a syntax error. | |
C2062 | type type unexpected |
The compiler did not expect the given type to appear here, possibly because it already had a required type. | |
This error can also be caused by a missing semicolon. | |
C2063 | identifier : not a function |
The given identifier was not declared as a function but was used as a function. | |
The following example in C generates this error:
int i, j; j = i(); // error, i is not a function |
|
C2064 | term does not evaluate to a function |
A call was made to a function through an expression that did not evaluate to a function pointer. | |
This error is probably caused by attempting to call a nonfunction. | |
The following is an example of this error:
int i, j; char* p; void func() { j = i(); // error, i is not a function p(); // error, p doesn't point to a function } |
|
C2065 | identifier : undeclared identifier |
The specified identifier was not declared. | |
A variable's type must be specified in a declaration before it can be used. The parameters that a function uses must be specified in a declaration before the function can be used. | |
This error can be caused if an include file containing the required declaration was omitted. | |
C2066 | cast to function type is illegal |
An object was cast to a function type, which is illegal. | |
In ANSI C, it is not legal to cast between a pointer to a function and a pointer to data. | |
C2067 | cast to array type is illegal |
An object was cast to an array type. | |
C2068 | illegal cast |
A type used in a cast operation was not legal for this expression. | |
C2069 | cast of void term to nonvoid |
A term of type void was cast to a different type. | |
Type void cannot be cast to any other type. | |
C2070 | illegal sizeof operand |
The operand of a sizeof expression was not an expression or a type name. | |
C2071 | identifier : illegal storage class |
The named identifier was declared with an illegal storage class. | |
C2072 | identifier : initialization of a function |
An initializer for a function was illegally specified. | |
C2073 | identifier : partially initialized array requires a default constructor |
An array of user-defined types or an array of consts was specified with too few initializers. | |
If an explicit initializer (and its corresponding constructor) is not specified for a member of an array, then a default constructor must be supplied. | |
The following is an example of this error:
class A { public: A( int ); // constructor for ints only }; A a[3] = { A(1), A(2) }; // error, no default constructor class B { public: B(); // default constructor declared B( int ); }; B b[3] = { B(1), B(2) }; // OK |
|
C2074 | identifier : class-key initialization needs curly braces |
There were no curly braces ({}) around the specified class, structure, or union initializer. | |
C2075 | identifier : array initialization needs curly braces |
There were no curly braces ({}) around the specified array initializer. | |
C2077 | nonscalar field initializer identifier |
An attempt was made to initialize a bit-field member of a structure with a non-scalar value. | |
C2078 | too many initializers |
The number of initializers exceeded the number of objects to be initialized. | |
C2079 | identifier uses undefined class/struct/union name |
The specified identifier was declared as a class, structure, or union that was not defined. | |
This error can be caused by initializing an anonymous union. | |
C2080 | illegal __far __fastcall function |
If stack checking is enabled, a __far __fastcall function cannot be compiled with the /Gw or /Gq option. | |
C2082 | redefinition of formal parameter identifier |
A formal parameter to a function was redeclared within the function body. | |
C2083 | struct/union comparison illegal |
A structure or union was directly compared with another user-defined type. | |
A user-defined type cannot be compared with another user-defined type unless a comparison operator has been defined or unless a conversion to a scalar type exists. | |
The following is an example of this error:
struct A { int i; } a, b; void func() { if( a == b ); // error, structure comparison } |
|
C2084 | function function already has a body |
The function has already been defined. | |
C2085 | identifier : not in formal parameter list |
The identifier was declared in a function definition but not in the formal parameter list. | |
A common cause of this error is the omission of a semicolon (;) at the end of a function prototype, as in:
void func1( void ) void main( void ) { } |
|
With the semicolon missing, func1() is taken to be a function definition, not a prototype. This means the function main() is being defined within func1(). Error C2085 is generated for the identifier main. | |
This is an error in ANSI C only. | |
C2086 | identifier : redefinition |
The given identifier was defined more than once, or a subsequent declaration differed from a previous one. | |
The following examples generate this error:
int a; char a; main() { } main() { int a; int a; } |
|
The following is an error in C++ but not in ANSI C:
int a; int a; main() { } |
|
C2087 | identifier : missing subscript |
The definition of an array with multiple subscripts was missing a subscript value for a dimension other than the first dimension. | |
The following is an example of this error:
int func(a) char a[10][]; // error { } int func(a) char a[][5]; // OK { } |
|
C2088 | operator : illegal for class-key |
The specified operator was not defined for the class, structure, or union. | |
This error can be eliminated by defining a conversion to convert the operands to the type for which the operator is defined. Alternatively, an overloaded conversion operator can be defined. | |
An example of this error and two solutions are:
class A { public: int i; } a; int i = 1 + a; // this line causes the error class B { public: operator int() { return i; } int i; } b; int j = 1 + b; // OK, uses conversion operator class C { public: int operator+( int j ) { return (j+i); } // solution int i; } c; int k = c + 1; // OK, uses overloaded operator+ int i = 1 + c; // still an error, no conversion // operator defined for class C |
|
Note that the last line requires that a conversion operator be defined since overloaded operators cannot be defined for built-in types. | |
C2089 | identifier : class-key too large |
The specified structure or union was larger than 64K. | |
A structure or union cannot be larger than 64K. | |
C2090 | function returns array |
A function cannot return an array. It can return a pointer to an array. | |
C2091 | function returns function |
A function cannot return a function. It can return a pointer to a function. | |
C2092 | array element type cannot be function |
Arrays of functions are not allowed. Arrays of pointers to functions are allowed. | |
C2093 | cannot use address of automatic variable as static initializer |
The program tried to use the address of an automatic variable in the initializer of a static item, as in the following example:
func() { int i; static int *ip=&i; // error } |
|
C2094 | label identifier was undefined |
A goto label was found, but the specified label did not exist in the same function. | |
C2095 | function : actual parameter has type void : parameter number |
An attempt was made to pass a void parameter to a function. The given number indicates which parameter was in error. | |
Formal parameters and parameters to functions cannot have type void. They can, however, have type void * (pointer to void). | |
C2097 | illegal initialization |
One of the following was illegally attempted:
Initialization of a variable using a nonconstant value Initialization of a short address with a long address Initialization of a local structure, union, or array with a nonconstant expression when compiling with /Za Initialization with an expression containing a comma operator (,) Initialization with an expression that is neither constant nor symbolic |
|
C2098 | nonaddress expression |
An address was expected as the initialization expression. | |
C2099 | nonconstant initializer |
The initializer was not a constant. | |
The following is an example of this error when compiled as C:
int i, j; int *p; j = i(); // error, i() is not constant j = *p; // error, *p is not a constant |
|
C2100 | illegal indirection |
The indirection operator (*) was applied to a nonpointer value. | |
C2101 | '&' on constant |
The address-of operator (&) did not have an l-value as its operand. | |
C2102 | '&' requires l-value |
The address-of operator (&) must be applied to an l-value expression. | |
C2103 | '&' on register variable |
An attempt was made to use the address of a register variable. | |
C2104 | '&' on bit field ignored |
An attempt was made to use the address of a bit field. | |
C2105 | operator needs l-value |
The given operator did not have an l-value operand. | |
C2106 | operator : left operand must be l-value |
The left operand of the given operator was not an l-value. | |
C2107 | illegal index; indirection not allowed |
A subscript was applied to an expression that did not evaluate to a pointer. | |
C2108 | nonintegral index |
A nonintegral expression was used in an array subscript. | |
C2109 | subscript on nonarray |
A subscript was used on a variable that was not an array. | |
C2110 | pointer + pointer |
An attempt was made to add one pointer to another using the plus operator (+). | |
C2111 | pointer + nonintegral value |
An attempt was made to add a nonintegral value to a pointer using the plus operator (+). | |
C2112 | illegal pointer subtraction |
An attempt was made to subtract pointers that did not point to the same type. | |
C2113 | pointer subtracted from nonpointer |
The right operand in a subtraction operation using the minus operator (–) was a pointer, but the left operand was not. | |
C2114 | operator : pointer on left; needs integral value on right |
The left operand of the given operator was a pointer. Therefore, the right operand must be an integral value. | |
C2115 | identifier : incompatible types |
An expression contained incompatible types. | |
C2116 | function parameter lists differed |
The parameters in the default parameter list did not match the formal parameter list. | |
C2118 | negative subscript |
A value defining an array size was negative. | |
C2119 | typedef types both define indirection |
Two typedef types were used to declare an item, and both typedef types had indirection. | |
For example, the declaration of p in the following example is illegal:
typedef int *p_int; typedef short *p_short; p_short p_int p; // error |
|
C2120 | void illegal with all types |
The void type was used in a declaration with another type. | |
C2121 | operator : bad left/right operand |
The left or right operand of the given operator was illegal for that operator. | |
C2122 | identifier : prototype parameter in name list illegal |
The specified parameter was not a legal type. | |
User-defined types are not supported in ANSI C. | |
C2123 | function1 : cannot call __fastcall function function2 from p-code |
There was an attempt to call a fastcall function from within a p-code function. | |
Rebuild function2 with a different calling convention, or turn off p-code generation for function1 by using #pragma optimize( "q", off ). | |
C2124 | divide or mod by zero |
A constant expression was evaluated and found to have a zero denominator. | |
C2125 | identifier : allocation exceeds 64K |
The given item exceeded the size limit of 64K. | |
C2126 | operand : incorrect operand |
The specified operator was used on an enumeration. | |
The increment and decrement operators (++ and ––) are not defined for enumerated types. | |
C2127 | parameter allocation exceeds 32K |
The storage space required for the parameters to a function exceeded the limit of 32K. | |
C2128 | function : no function with C linkage found |
The specified function was not found. | |
This error is caused by omitting the file containing the function definition from the project list or makefile, by not defining the function within the file scope, or by omitting the keyword extern in the function prototype. | |
C2129 | static function function declared but not defined |
A forward reference was made to a static function that was never defined. | |
A function declared with static linkage must be defined within file scope. If the function is defined in another file, it should be declared with the keyword extern. | |
C2130 | #line expected a string containing the filename; found token |
The optional token following the line number on a #line directive was not a string. | |
C2131 | more than one memory attribute |
More than one memory attribute ( __near, __far, __huge, or __based) was applied to an item, as in the following example:
typedef int __near nint; nint __far a; // error |
|
C2132 | syntax error : unexpected identifier |
An identifier appeared in a syntactically illegal context. | |
C2133 | identifier : unknown size |
An unsized array was declared as a member of a class, structure, union, or enumeration. | |
Unsized member arrays are not allowed when the /Za (ANSI) switch has been chosen. | |
The following is an example of this error:
struct X { int a[0]; // error, unsized array }; |
|
C2134 | identifier : struct/union too large |
The size of a structure or union exceeded the compiler limit of 64K. | |
C2135 | identifier : illegal bit-field operation |
The address of the specified bit field was taken. | |
The address-of operator (&) cannot be applied to a bit field. | |
The following is an example of this error:
struct S { int i : 1; int j; }; void main() { &S::i; // error, address of a bit field &S::j; // OK } |
|
C2136 | function : prototype must have parameter types |
A function prototype declaration had formal parameter names, but no types were provided for the parameters. | |
A formal parameter in a function prototype must either have a type or be represented by an ellipsis (...) to indicate a variable number of parameters and no type checking. | |
One cause of this error is a misspelling of a type name in a prototype that does not provide the names of the formal parameters. | |
C2137 | empty character constant |
The illegal empty character constant ('') was used. | |
C2139 | type following identifier is illegal |
Two types were used in the same declaration, as in:
int double a; |
|
C2140 | parameter cannot be function type |
A function was illegally declared as a formal parameter of another function. | |
C2141 | value out of range for enum constant |
An enumeration constant had a value outside the range of values allowed for an integer type. | |
C2142 | function declarations differ; variable parameters specified only in one of them |
One declaration of the function contained a variable parameter list, but another declaration did not. | |
This causes an error in C when the /Za (ANSI) switch is chosen. | |
The following is an example of this error:
void func(); void func( int, ... ); |
|
C2143 | syntax error : missing token1 before token2 |
The compiler expected token1 to appear before token2. | |
This error can be caused by a missing closing brace (}), right parenthesis, or semicolon (;). The missing token may belong on the line above where the error was detected. | |
This error can also be caused by an invalid tag in a class declaration. | |
The following are examples of this error:
class X { int member } x; // error, missing ; on previous line class + {}; // error, + is invalid tag name |
|
C2144 | syntax error : missing token before type type |
The compiler expected the given token to appear before the given type name. | |
This error can be caused by a missing closing brace (}), right parenthesis, or semicolon (;). | |
C2145 | syntax error : missing token before identifier |
The compiler expected the given token to appear before an identifier. | |
This error can be caused by a missing semicolon (;) after the last declaration in a block. | |
C2146 | syntax error : missing token before identifier identifier |
The compiler expected the given token to appear before the given identifier. | |
C2148 | array too large |
An array exceeded the maximum legal size of 64K. | |
Either reduce the size of the array or declare it with __huge. | |
C2149 | identifier : named bit field cannot have zero width |
The given named bit field had zero width. Only unnamed bit fields are allowed to have zero width. | |
C2150 | identifier : bit field must have type int, signed int, or unsigned int |
The ANSI C standard requires bit fields to have types of int, signed int, or unsigned int. This message appears only when compiling with the /Za option. | |
C2151 | more than one language attribute |
More than one keyword specifying a calling convention (__cdecl, __fortran, __pascal, or __fastcall) for a function was given. | |
C2152 | identifier : pointers to functions with different attributes |
An attempt was made to assign a pointer to a function declared with one calling convention (__cdecl, __fortran, __pascal, or __fastcall) to a pointer to a function declared with a different calling convention. | |
C2153 | hex constants must have at least one hex digit |
The hexadecimal constants 0x, 0X, and \x are illegal. At least one hexadecimal digit must follow the x or X. | |
C2154 | segment : does not refer to a segment name |
A segment must be allocated when a based variable is declared unless it is extern and uninitialized. | |
C2156 | pragma must be outside function |
A pragma that must be specified at a global level (that is, outside a function body) occurred within a function. | |
The following is an example of this error:
main() { #pragma optimize( "l", on ) } |
|
C2157 | function : must be declared before use in pragma list |
The function name in the list of functions for an alloc_text pragma has not been declared prior to being referenced in the list. | |
C2158 | identifier : is a function |
The given identifier was specified in the list of variables in a same_seg pragma but was previously declared as a function. | |
C2159 | more than one storage class specified |
A declaration contained more than one storage class, as in:
extern static int i; // error |
|
C2160 | ## cannot occur at the beginning of a macro definition |
A macro definition began with a token-pasting operator (##), as in:
#define mac(a,b) ##a |
|
C2161 | ## cannot occur at the end of a macro definition |
A macro definition ended with a token-pasting operator (##), as in:
#define mac(a,b) a## |
|
C2162 | expected macro formal parameter |
The token following a stringizing operator (#) was not a formal parameter name. | |
The following is an example of this error:
#define print(a) printf(#b) |
|
C2163 | function : not available as an intrinsic function |
A function specified in the list of functions for an intrinsic or function pragma is not one of the functions available in intrinsic form. | |
C2164 | function : intrinsic function not declared |
The given function was not declared before being used in an intrinsic pragma. This error appears only when compiling with the /Oi option. | |
C2165 | keyword : cannot modify pointers to data |
The __fortran, __pascal, __cdecl, or __fastcall keyword was used illegally to modify a pointer to data, as in the following example:
char __pascal *p; |
|
C2166 | l-value specifies const object |
An attempt was made to modify an item declared with const type. | |
C2167 | function : too many actual parameters for intrinsic function |
A reference to a function declared as intrinsic contained too many actual parameters. | |
C2168 | function : too few actual parameters for intrinsic function |
A reference to a function declared as intrinsic contained too few actual parameters. | |
C2169 | function : intrinsic function; cannot be defined |
An attempt was made to provide a function definition for a function already declared as an intrinsic. | |
C2170 | identifier : not declared as a function; cannot be intrinsic |
The intrinsic pragma was used for an item other than a function or for a function that does not have an intrinsic form. | |
C2171 | operator : illegal operand |
The given unary operator was used with an illegal operand type, as in the following example:
int (*fp)(); double d, d1; fp++; // error d = ~d1; // error |
|
C2172 | function : actual parameter is not a pointer : parameter number |
An attempt was made to pass an parameter that was not a pointer to a function that expected a pointer. The given number indicates which parameter was in error. | |
C2173 | function : actual parameter is not a pointer : parameter number1, parameter list number2 |
An attempt was made to pass a nonpointer parameter to a function that expected a pointer. | |
This error occurs in calls that return a pointer to a function. The first number indicates which parameter was in error; the second number indicates which parameter list contained the invalid parameter. | |
C2174 | function : actual parameter has type void : parameter number1, parameter list number2 |
An attempt was made to pass a void parameter to a function. Formal parameters and parameters to functions cannot have type void. They can, however, have type void* (pointer to void). | |
This error occurs in calls that return a pointer to a function. The first number indicates which parameter was in error; the second number indicates which parameter list contained the invalid parameter. | |
C2176 | static huge data not supported by identifier |
A huge array was declared in a p-code function. | |
Arrays declared using __huge are not allowed in p-code functions. | |
C2177 | constant too big |
A constant value was too large to be represented in the type to which it was assigned. | |
C2178 | identifier : storage class for same_seg variables must be extern |
The given variable was specified in a same_seg pragma, but the variable was not declared with extern storage class. | |
C2179 | identifier : was used in same_seg, but storage class is no longer extern |
The given variable was specified in a same_seg pragma, but the variable was redeclared with a storage class other than extern. | |
C2180 | controlling expression has type void |
The controlling expression in an if, while, for, or do statement was either a function with void return type or an expression cast to void. | |
C2182 | identifier : has type void |
The given variable was declared with the keyword void, which can be used only in function declarations. | |
C2184 | illegal return of a void value |
The function did not return a value. | |
The function was declared as returning a nonvoid value, but the return statement did not return a value. | |
C2185 | identifier : illegal based allocation |
A based-allocated variable that explicitly has extern storage class and is uninitialized cannot have any of the following bases:
(__segment) & var __segment ("_STACK") (__segment) __self void |
|
If the variable does not explicitly have extern storage class or is initialized, then its base must use __segname("string") where string is any segment name or reserved segment name except _STACK. | |
C2186 | operand : illegal operand of type void |
The specified operator had a void operand. | |
The following is an example of this error:
void func1( void ); int func2( void ); int i = 2 + func1(); // error, func1() is type void int j = 2 + func2(); // OK, both operands are type int |
|
C2187 | cast of near function pointer to far function pointer |
A near function pointer was cast to a far function pointer. | |
This cast is not allowed. | |
C2188 | number : too big for wide character |
The given number is too large to be held in the wide-character type. | |
Choose a larger type to hold the given value. | |
C2189 | #error : string |
An #error directive was encountered. | |
The string is the descriptive text supplied in the directive. | |
C2190 | first parameter list longer than second |
The function was declared a second time with a shorter parameter list. | |
C does not support overloaded functions. | |
The following is an example of this error:
void func( int, float ); void func( int, ); // error, different parameter list |
|
C2191 | second parameter list longer than first |
The function was declared a second time with a longer parameter list. | |
C does not support overloaded functions. | |
The following is an example of this error:
void func( int ); void func( int, float ); // error, different parameter list |
|
C2192 | parameter number declaration different |
The function was declared a second time with a different parameter list. | |
C does not support overloaded functions. | |
The following is an example of this error:
void func( float, int ); void func( int, float ); // error, different parameter list |
|
C2193 | identifier : already in a segment |
A variable in the same_seg pragma has already been allocated in a segment, using __based. | |
C2194 | segment : is a text segment |
The given text segment was used where a data, const, or BSS segment was expected. | |
C2195 | segment : is a data segment |
The given data segment was used where a text segment was expected. | |
C2197 | identifier : too many actual parameters |
The specified function was called with too many parameters, or the function declaration was incorrect. | |
The following is an example of this error:
void func( int ); main() { func( 1, 2 ); // error, two actual parameters } |
|
C2198 | identifier : too few actual parameters |
The specified function was called with too few parameters, or the function declaration was incorrect. | |
The following is an example of this error:
void func( int, int ); main() { func( 1 ); // error, only one actual parameter } |
|
C2199 | syntax error : found identifier ( at global scope (was a declaration intended?) |
The specified context caused a syntax error. | |
This error can be caused by incorrect declaration syntax. | |
The following is an example of this error:
struct S { public: int i; S( int si ) { i = si; } }; S(1) s; // error, incorrect syntax S s(1); // OK |
|
C2200 | function : function has already been defined |
A function name passed as an parameter in an alloc_text pragma has already been defined. | |
C2201 | function : storage class must be extern |
A function declaration appeared within a block, but the function was not declared as extern. This causes an error if the /Za ANSI-compatibility option is in effect. | |
The following example causes this error when compiled with /Za:
main() { static int func1(); // error } |
|
C2202 | function : not all control paths return a value |
The specified function can potentially not return a value. | |
The following is an example of this error:
int func1( int i ) { if( i ) return 3; // error, nothing returned if i = 0 } int func2( int i ) { if( i ) return 3; else return 0; // OK, always returns a value } |
|
C2203 | delete operator cannot specify bounds for an array |
The delete operator can only delete an entire array; it cannot delete parts or specific members of the array. This error is generated only with the /Za ANSI-compatibility option. | |
This was not an error in C++ 2.0 but is an error in C++ 2.1. | |
The following statement generates this error:
delete [4] ArrayOfObjects; // error |
|
C2204 | identifier : type definition found within parentheses |
The specifed type was defined in prototype scope or as an operand. | |
The following is an example of this error:
( struct S {}; ); // error |
|
C2205 | identifier : cannot initialize extern variables with block scope |
A variable with extern storage class cannot be initialized in a function. | |
C2206 | function : typedef cannot be used for function definition |
A typedef was used to define a function type. | |
For example:
typedef int functyp(); functyp func1 {}; // error |
|
C2207 | member in struct/union tag has a zero-sized array |
The given member in the structure or union contains an array that does not have a subscript or that has a zero subscript. This kind of array is legal only as the last member of a structure or union. | |
C2208 | type : no members defined using this type |
An enumeration, structure, or union was defined without any members. This is an error only when compiling with /Za; otherwise, it is a warning. | |
C2209 | type cast in __based construct must be (__segment) |
Only type __segment can be used within a cast in a __based declarator. | |
C2210 | identifier : must be near/far data pointer |
The base in a __based declarator must be a near or far data pointer and cannot be an array, function, or based pointer. | |
C2211 | (__segment) applied to function identifier function |
A function cannot be cast in a __based declarator. | |
C2212 | identifier : __based not available for pointers to functions |
Based pointers cannot be used to point to functions. Function pointers can be __near or __far only. | |
C2213 | identifier : illegal parameter to __based |
The parameter used as a base must have type __segment or be a near or far pointer. | |
C2214 | pointers based on void require the use of :> |
A based pointer based on void cannot be dereferenced. Use the base operator (:>) to create an address that can be dereferenced. | |
C2215 | :> operator only for objects based on void |
The right operand of the base operator (:>) must be a pointer based on void, as in:
char __based( void ) *cbvpi; |
|
C2216 | attribute1 cannot be used with attribute2 |
The given function attributes are incompatible. | |
Some combinations of attributes that cause this error are:
__saveregs and __interrupt __fastcall and __saveregs __fastcall and __interrupt __fastcall and __export |
|
C2217 | attribute1 must be used with attribute2 |
The first function attribute requires the use of the second attribute. | |
Some causes for this error include:
An interrupt function explicitly declared as near. Interrupt functions must be declared as far. An interrupt function that is declared with the __fortran, __pascal, or __fastcall attribute. Functions declared with the __interrupt attribute must use C calling conventions. A function with a variable number of parameters that is declared with the __fortran, __pascal, or __fastcall attribute. These functions must use C calling conventions. Remove the __fortran, __pascal, or __fastcall attribute from the function declaration. |
|
C2218 | type in __based construct must be void |
The only type allowed in a __based construct is void. | |
C2219 | syntax error : type qualifier must be after '*' |
Either const or volatile appeared where a type or qualifier is not permitted, as in:
int (const *p); |
|
C2220 | warning treated as error—no object file generated |
When the compiler option /WX is used, the first warning generated by the compiler causes this error message to be displayed. | |
Either correct the condition that caused the warning or compile at a lower warning level or without /WX. | |
C2221 | '.' : left operand points to class/struct/union; use '–>' |
The left operand of the member-of operator (.) must be a class, (or structure or union) but not a pointer to a class type. | |
The class member access operator (–>) can be used with a pointer to a class, structure, or union. | |
C2222 | '–>' : left operand has class/struct/union type; use '.' |
The left operand of the class member access operator (–>) must be a pointer to a class (or structure or union) type but not a class type. | |
The member-of operator (.) can be used with a class, structure, or union type. | |
C2223 | left of –>member must point to class/struct/union |
The left operand of the member access operator (–>) is not a pointer to a class, structure, or union type. | |
This error can occur when the left operand is an undefined variable. Undefined variables have type int. | |
C2224 | left of .member must have class/struct/union type |
The left operand of the member-of operator (.) is not a class, structure, or union type. | |
This error can occur when the left operand is an undefined variable. Undefined variables have type int. | |
C2226 | syntax error : unexpected type type |
A syntax error occured before, or in, the given type specifier. | |
The following is an example of this error:
int func1( int, ... , float ); // error, misplaced ellipsis int func2( int, float, ... ); // OK |
|
C2227 | left of –>identifier must point to class/struct/union |
The left side of the specified class member access operator (–>) was not a pointer to a class, structure, or union. | |
The following is an example of this error:
int *pInt; struct S { public: int member; } *pS; void main() { pInt->member = 0; // error, pInt points to an int pS->member = 0; // OK, pS points to a structure S } |
|
C2228 | left of .identifier must have class/struct/union type |
The left side of the specified class member access operator (.) was not a class (or structure or union) type. | |
The following is an example of this error:
int i; struct S { public: int member; } s, *ps; void main() { i.member = 0; // error, i is not a class type ps.member = 0; // error, ps is a pointer to a structure s.member = 0; // OK, s is a structure type ps->member = 0; // OK, ps points to a structure S } |
|
C2229 | type identifier has an illegal zero-sized array |
The specified member of the structure or bit field contained a zero-sized array. | |
The following is an example of this error:
struct S { int a[0]; // error, zero-sized array int b[1]; // OK }; |
|
C2230 | identifier : first member of class-key is unnamed |
The first member of a bit field was unnamed. | |
The first member of a bit field must be named. | |
C2231 | '.' : left operand points to class-key; use '–>' |
The left operand to the member selection operator (.) was a pointer to a class, structure, or union. | |
The left operand to the member selection operator must be a class, structure, or union. | |
The following is an example of this example:
struct S { public: int member; } s, *ps; void main() { ps.member = 0; // error, ps points to structure S ps->member = 0; // OK, ps points to a structure S s.member = 0; // OK, s is a structure type } |
|
C2232 | '–>' : left operand has class-key type; use '.' |
The class member access operator (–>) was used on a nonpointer. | |
The pointer form of the class member access operator can only be used with a pointer to a class, structure, or union. The dot (.) form of the operator should be used with a class, structure, or union type. | |
The following is an example of this error:
struct X { int member; } x, *px; void main() { x->member = 0; // error, x is not a pointer px->member = 0; // OK, px is a pointer to an X x.member = 0; // OK } |
|
C2234 | arrays of references are illegal |
An array of references was declared. | |
Since pointers to references are not allowed, arrays of references are not possible. A pointer should be used to implement the array. | |
C2235 | ';' in formal parameter list |
A semicolon (;) was found in a formal parameter list. | |
The error is usually caused by using a semicolon instead of a comma (,) to separate parameters in a formal parameter list. | |
The following is an example of this error:
void func( int i; float f ); // error, uses semicolon void func( int i, float f ); // OK, uses comma |
|
C2236 | unexpected class-key identifer |
The specified identifier was already defined as a type and cannot be overridden by a new user-defined type. | |
C2237 | unexpected class-key identifier |
The specified class-key was not followed by a valid class name. | |
The following is an example of this error:
class + {}; // error, + is invalid class name |
|
C2238 | unexpected token preceding token |
An incorrect token, or tokens, was found before the specified token. | |
This error can be caused by an invalid name in a bit-field declaration. | |
The following is an example of this error:
struct bits { int field1 : 16; int 9 : 16; // error, 9 is not a valid name }; |
|
C2239 | unexpected token token following declaration of identifier |
An unexpected token was found in the specified declaration. | |
The following is an example of this error:
int i 8; // error, missing = int j = 7; // OK |
|
C2241 | identifier : member access is restricted |
There was an attempt to access a private or protected member function or data. | |
If the program needs to access this member, change the object access level or make the member a friend of the function that needs to be accessed. | |
C2244 | identifier : unable to resolve function overload |
The specified overloaded function call was ambiguous. | |
The following is an example of this error:
int func( char ); int func( int ); void main () { +func; // error, can't resolve which func to use +func( 0 ); // OK } |
|
C2245 | nonexistent function identifier specified as friend |
The specified identifier was not a function. | |
Only a function can be specified as a friend. | |
The following is an example of this error:
class C { public: int i; // i is not a function void func(); }; class S { public: friend void C::i(); // error friend void C::func(); // OK }; |
|
C2246 | identifer : illegal static data member in locally defined class |
The specified member of a class, structure, or union with local scope was declared as static. | |
The following is an example of this error:
void func( void ) { class A { static int i; // error, i is local to func }; }; class B { static int i; // OK }; |
|
C2247 | identifier not accessible because class uses specifier to inherit from class |
The specified identifier was inherited from a class declared with private or protected access. | |
The following is an example of this error:
class A { public: int i; }; class B : private A {}; // B inherits a private A class C : public B {} c; // so even though C's B is public int j = c.i; // error, i not accessible |
|
C2248 | member : cannot access specifier member declared in class class |
The specified private or protected member of a class, structure, or union was accessed. | |
The member should be accessed through a member function with public access or should be declared with public access. | |
The following is an example of this error:
class X { public: int pubMemb; void setPrivMemb( int i ) { privMemb = i; } protected: int protMemb; private: int privMemb; } x; void main() { x.privMemb = 0; // error, privMemb is private x.protMemb = 0; // error, protMemb is protected x.pubMemb = 0; // OK, pubMemb is public x.setPrivMemb( 0 ); // OK, uses public access function } |
|
C2249 | identifier : no accessible path to specifier member declared in virtual base class |
The specified inherited member was inherited from a nonpublic virtual base class or structure. | |
The following is an example of this error:
class A { private: void privFunc( void ) {}; public: void pubFunc( void ) {}; }; class B : virtual public A {} b; void main( void ) { b.privFunc(); // error, private member of A b.pubFunc(); // OK } |
|
C2250 | identifier : ambiguous inheritance of class::member |
The derived class inherited more than one override of a virtual function of a virtual base. These overrides are ambiguous in the derived class. | |
The following is an example of this error:
struct V { virtual void vf(); }; struct A : virtual V { void vf(); }; struct B : virtual V { void vf(); }; struct D : A, B {}; //error |
|
C2252 | identifier : pure specifier can only be specified for functions |
The given nonfunction was specified as pure virtual. | |
Only member functions specified as virtual can be declared with a pure specifier. | |
The following is an example of this error:
class A { virtual int i = 0; // error, i is an int virtual void func() = 0; // OK, func is a function }; |
|
C2253 | function : pure specifier only applies to virtual function |
The specified nonvirtual function was specified as pure virtual. | |
The specifier was ignored. | |
The following is an example of this error:
class A { public: void func1() = 0; // error, not virtual virtual void func2() = 0; // OK }; |
|
C2254 | function : pure specifier not allowed on friend functions |
The specified friend function was specified as pure virtual. | |
The following is an example of this error:
class A { public: friend void func1() = 0; // error, func1 is friend void virtual func2() = 0; // OK, pure virtual friend void func3(); // OK, friend not virtual nor }; // pure void func1() {}; void func3() {}; |
|
C2255 | function : a friend function can only be declared in a class |
The specified function was declared with the friend specifier outside of a class, structure, or union. | |
The following is an example of this error:
class A { private: void func1(); friend void func2(); }; friend void func1() {}; // error void func2() {}; // OK |
|
C2256 | illegal use of friend specifier on destructor |
The specified destructor was specified as a friend. | |
A destructor cannot be specifed as a friend. | |
The following is an example of this error:
class C { public: friend ~C(); // error ~C(); // OK }; |
|
C2257 | p-code generation pragma not allowed without /Oq |
The "q" optimization pragma is not allowed without the /Oq p-code command-line option. | |
To generate p-code from CL, use the /Oq p-code command-line option. Once the option has been set, the optimization pragmas can turn p-code generation on and off. | |
C2258 | illegal pure syntax, must be '= 0' |
A pure virtual function was declared with incorrect syntax. | |
The following is an example of this error:
class A { public: void virtual func1() = 1; // error, not = 0 void virtual func2() = 0; // OK }; |
|
C2259 | class : illegal attempt to instantiate abstract class |
An object of the specified abstract class or structure was declared. | |
A class (or structure) with one or more pure virtual functions cannot be instantiated. Each pure virtual function must be overridden in a derived class before objects of the derived class can be instantiated. | |
The following is an example of this error:
class V { public: void virtual func() = 0; }; class A : public V {}; class B : public V { public: void func(); }; V v; // error, V is an abstract class A a; // error, A inherits func() as pure virtual B b; // OK, B defines func() |
|
C2260 | function pointer cast to a data pointer |
A pointer to a function was cast to a pointer to data. | |
This cast is not legal in ANSI C. | |
This cast is legal in C++ and is allowed by the Microsoft extensions (using the /Ze switch). | |
C2261 | data pointer cast to a function pointer |
A pointer to data was cast to a pointer to a function. | |
This cast is not legal in ANSI C. | |
This cast is legal in C++ and is allowed by the Microsoft extensions (using the /Ze switch). | |
C2262 | identifier : cannot be destroyed |
The specified identifier was not instantiated because an appropriate destructor was not available. | |
The following is an example of this error:
struct S { ~S() __near; }; S __far fs; // error, wrong memory model for destructor class B { ~B(); }; class D : public B {}; D d; // error, B's destructor is private |
|
C2263 | function returns pointer based on __self |
A function attempted to return a pointer based on the __self segment. Since __self refers to the code segment of the function, it is impossible to return this base to another function. | |
Modify the return statement so that it returns a different type, such as a far pointer or a pointer based on void. | |
C2264 | function : error in function definition or declaration; function not called |
Since the specified function was incorrectly defined or declared, it could not be called. | |
The following is an example of this error:
class C { public: operator int( int = 10 ); // incorrect declaration here }; void main() { int i; C c; i = c; // error } |
|
C2268 | operation : different const or volatile qualifiers |
The given operation was performed on a variable that was defined as being const or volatile. As a result, the const or volatile item could be modified without being detected by the compiler. | |
This error often occurs when a pointer to an item declared as const or volatile is assigned to a pointer that was not declared as pointing to either of these type modifiers. | |
The following is an example of this error:
const char *p = "abcde"; int str( char *s ); str( p ); |
|
C2269 | identifier : different ambient model than base class class |
The specified derived class or structure did not explicitly specify an ambient memory model. | |
A class that is derived from base classes with differing ambient memory models must specify an ambient memory model. | |
The following is an example of this error:
class __far F {}; class __near N {}; class Err : F, N {}; // error class __far NoErr : F, N {}; // OK |
|
C2270 | identifier : modifiers not allowed on nonmember functions |
The specified nonmember function was declared with a memory-model modifier. | |
Only functions that are members of a class, structure, or union can have memory-model modifiers. | |
The following is an example of this error:
void func1() __near; // error, nonmember function class C { public: void func2() __near; // OK }; |
|
C2271 | operator : new/delete cannot have formal list modifiers |
The specified operator was declared with a memory-model specifier. | |
A memory-model specifier cannot be specified for the new or delete operators. | |
The following is an example of this error:
class C { void *operator new( unsigned ) __far; // error }; |
|
C2272 | function : modifiers not allowed on static member functions |
The specified static member function was declared with a memory-model specifier. | |
The following is an example of this error:
class C { public: static void func1() __far; // error, func1 is static void func2() __far; // OK }; |
|
C2273 | type : illegal as right side of –> operator |
The given type was specified on the right hand side of the class member access operator (–>). | |
To access a user-defined type conversion, use the operator keyword between the –> operator and the type. | |
The following is an example of this error:
i = ClassPtr->int( a ); // error i = ClassPtr->operator int( a ); // OK |
|
C2274 | type : illegal as right side of '.' operator |
The given type was specified on the right side of the class member access operator (.). | |
To access a user-defined type conversion, use the operator keyword between the dot operator (.) and the type. | |
The following is an example of this error:
i = ClassName.int( a ); // error i = ClassName.operator int( a ); // OK |
|
C2350 | identifier is not a static member |
A nonstatic member of a class or structure was defined. | |
Only a static member or member of an instance or a class or structure can be defined. | |
The following is an example of this error:
class C { public: int i; static int s; }; void main() { int C::i = 0; // error, nonstatic member int C::s = 0; // OK, static member C.c; c.i = 0; // OK, member of instance of C } |
|
C2351 | obsolete C++ constructor initialization syntax |
A direct base class was not named in the constructor. | |
The new-style initialization list for a constructor member requires each direct base class to be explicitly named, even if it is the only base class in the list. | |
The following is an example of this error:
class B { public: B(); B( int ); }; class D : public B { public: D( int i ) : ( i ) {} // error, B was not named D( int i ) : B( i ) {} // OK }; |
|
C2352 | class::function : illegal call of nonstatic member function |
The specified nonstatic member function was called in a static member function. | |
The following is an example of this error:
class X { public: static void func1(); void func2(); static void func3() { func1(); // error, calls static func1 func2(); // OK, calls nonstatic func2 } }; |
|
C2353 | constructor : improper use of constructor initializers |
The constructor initializer syntax was incorrect. | |
This error can be caused by omitting the constructor definition from a constructor initializer. | |
The following is an example of this error:
class C { public: C() : i( 10 ); // error, missing definition C() : i( 10 ){}; // OK private: int i; }; |
|
C2354 | reference : initialization of reference to member requires a temporary variable |
A reference to a member was initialized in a constructor. | |
The member should be initialized instead of its reference. | |
C2355 | this : can only be referenced inside nonstatic member functions |
The this pointer is only valid within nonstatic member functions. Make sure that the this pointer is being used in this context. | |
The following code generates this error in global scope:
char *p = this; // error |
|
C2356 | initialization segment cannot change within translation unit |
The #pragma init_seg statement cannot be preceded by segment initialization code. The #pragma init_seg statement must precede any code and cannot be preceded by another #pragma init_seg statement. | |
Move the segment initialization code to the beginning of the module. If multiple areas must be initialized, move them to seperate modules. | |
C2360 | initialization of identifier is skipped by case label |
The specified identifier initialization can be skipped in a switch statement. | |
It is illegal to jump past a declaration with an initializer unless the declaration is enclosed in a block. | |
The scope of the initialized variable lasts until the end of the switch statement unless it is declared in an enclosed block within the switch statement. | |
The following is an example of this error:
void func( void ) { int x; switch ( x ) { case 0 : int i = 1; // error, skipped by case 1 { int j = 1; } // OK, initialized in enclosing block case 1 : int k = 1; // OK, initialization not skipped } } |
|
C2361 | initialization of identifier is skipped by default label |
The specified identifier initialization can be skipped in a switch statement. | |
It is illegal to jump past a declaration with an initializer unless the declaration is enclosed in a block. | |
The scope of the initialized variable lasts until the end of the switch statement unless it is declared in an enclosed block within the switch statement. | |
The following is an example of this error:
void func( void ) { int x; switch (x) { case 0 : int i = 1; // error, skipped by default { int j = 1; } // OK, initialized in enclosing block default : int k = 1; // OK, initialization not skipped } } |
|
C2362 | initialization of identifier is skipped by goto label |
A jump to the specified label prevented the specified identifier from being initialized. | |
It is illegal to jump past a declaration with an initializer unless:
The declaration is enclosed in a block that is not entered. The jump is from a point where the variable has already been initialized. |
|
The following is an example of this error:
void func() { goto label1; int i = 1; // error, initialization skipped { int j = 1; // OK, this block is never entered } label1:; } |
|
C2370 | identifer : redefinition; different storage class |
The given identifier was already declared with a different storage-class specifier. | |
The following is an example of this error:
extern int i; static int i; // error |
|
C2371 | identifier : redefinition; different basic types |
The specified identifier was already declared. | |
The following is an example of this error:
int i; int i(); // error |
|
C2372 | identifier : redefinition; different types of indirection |
The given identifier was already defined with a different derived type. | |
The following is an example of this error:
extern int *fp; extern int fp[]; // error |
|
C2373 | identifier : redefinition; different type modifiers |
The specified identifier was already defined with a different type modifier. | |
The following is an example of this error:
void __pascal func( void ); void __cdecl func( void ); // error |
|
C2374 | identifier : redefinition; multiple initialization |
The specified identifier was initialized more than once. | |
A variable can be initialized only once. | |
The following is an example of this error:
int i = 0; int i = 1; // error |
|
C2375 | function : redefinition; different linkage |
The specified function was already declared with a different linkage specifier. | |
The following is an example of this error:
extern void func( void ); static void func( void ); // error |
|
C2377 | identifier : redefinition; typedef cannot be overloaded with any other symbol |
The specified typedef identifier was redefined. | |
The following is an example of this error:
typedef int i; int i; // error |
|
C2378 | identifier : redefinition; symbol cannot be overloaded with a typedef |
The specified identifier was redefined as a typedef. | |
The following is an example of this error:
int i; typedef int i; //error |
|
C2380 | type[s] preceding identifier (constructor with return type or illegal redefinition of current class name?) |
The specified constructor returned a value or redefined the class name. | |
A constructor cannot specify a return value. | |
The following is an example of this error:
class C { public: int C(); // error, specifies an int return int C; // error, redefinition of i C(); // OK }; |
|
C2390 | identifier : incorrect storage class specifier |
The storage class was not legal for the specified identifer with global scope. | |
The default storage class for this context was used in place of the illegal class. | |
Correct use of storage classes include:
If the identifier is a function, it should be declared with extern storage. If the identifier is a formal parameter or local variable, it should be declared with auto storage. If the identifier is a global variable, it should be declared with no storage class (that is, auto storage). |
|
The following example generates this error:
register int i; //error void main () { register int j; //OK } |
|
C2400 | inline syntax error in context; found token |
The given token caused a syntax error within the given context. | |
C2401 | identifier : register must be base in context |
The register used within an indirect memory operand must be a base register in this context. | |
C2402 | identifier : register must be index in context |
The register used within an indirect memory operand must be an index register in this context. | |
C2403 | identifier : register must be base/index in context |
The register used within an indirect memory operand must be either a base or index register in this context. | |
C2404 | identifier : illegal register in context |
This register in this context is illegal. | |
C2405 | illegal short forward reference with offset |
Short forward references must refer only to a label. An additional offset cannot be used. | |
C2406 | identifier : name undefined in context |
The identifier used with the SIZE or LENGTH operator or as a specifier with the member-selection operator (.) was not defined. | |
C2407 | illegal float register in context |
An NDP register was specified in an illegal context. | |
C2408 | illegal type on PTR operator in context |
The first parameter of the PTR operator was not a legal type specification. | |
C2409 | illegal type used as operator in context |
An illegal type was used within the given context as an operator. | |
C2410 | identifier : ambiguous member name in context |
The given identifier within the given context is a member of more than one structure or union. | |
Use a structure or union specifier on the operand that caused the error. A structure or union specifier is an identifier of type struct or union, either a typedef name or a variable of the same type as the structure or union being referenced. The specifier token must be the left operand of the first member-selection operator (.) to use the operand. | |
C2411 | identifier : illegal struct/union member in context |
Either the given identifier used with this context is not a member of a visible structure or union or the identifier is not a member of the structure or union specified with the member-selection operator (.). | |
C2412 | identifier : case-insensitive label redefined |
The given label was defined more than once within the current function. Change the spelling of the label and its references. | |
C2413 | token : illegal align size |
The alignment size used with the ALIGN directive was either missing or outside the valid range. | |
C2414 | illegal number of operands |
The opcode does not support the number of operands used. | |
Check an assembly-language reference manual to determine the correct number of operands for this instruction. | |
It is possible that the instruction is supported with a different number of operands on a newer processor. The problem can be solved by compiling with the /G1 or /G2 option, but then only machines with the newer processor will be able to execute the extended instruction. | |
C2415 | improper operand type |
The opcode does not use operands of this type. | |
Check an assembly-language reference manual to determine the correct types of operands for this instruction. | |
It is possible that the instruction is supported with additional operand types on a newer processor. The problem can be solved by compiling with the /G1 or /G2 option, but then only machines with the newer processor will be able to execute the extended instruction. | |
C2416 | identifier : illegal opcode for processor |
The instruction is legal on a later processor but not on the current processor. | |
Check an assembly-language reference manual to determine which processors support this opcode. | |
The problem can be solved by compiling with the /G1 or /G2 option, but then only machines with the newer processor will be able to execute the extended instruction. | |
C2417 | divide by zero in context |
The second parameter to the division operator (/) used within the given context is zero. | |
C2418 | identifier : not in a register |
An inline assembler instruction referenced a variable with register storage class that was not actually allocated in a register. | |
To correct this, remove the register keyword from the variable definition and make sure that this instruction is legal with a memory operand. | |
C2419 | mod by zero in context |
The second parameter to the MOD operator used within the given context is zero. | |
C2420 | identifier : illegal symbol in context |
The given identifier is illegal within the given context. | |
C2421 | PTR operator used with register in context |
The PTR operator must not be used with a register operand. | |
C2422 | illegal segment override in context |
An illegal segment override was used within the given context. | |
C2424 | token : improper expression in context |
The given token was used to form an improper expression within the given context. | |
C2425 | token : nonconstant expression in context |
The given token was used to form a nonconstant expression within the given context. | |
C2426 | token : illegal operator in context |
The given token must not be used as an operator within the given context. For example, index operators cannot be nested. | |
C2427 | identifier : jump referencing label is out of range |
A branch to the specified label is farther than allowed. | |
For example, if the following example causes this error:
jz label1 inc AX label1: inc CX |
|
then this error can be corrected by either removing excess code between the branch and the label or inverting the jump, as in:
jnz label2 jmp label1 label2: inc AX label1: inc CX |
|
C2429 | label : illegal far label reference |
FAR PTR cannot be used on jumps or calls to labels. Far references to functions are allowed only if the function has been declared. | |
C2430 | more than one index register in identifier |
More than one of the specified registers were scaled. | |
The 32-bit targeted compiler supports scaled indexing, but you can only scale one register. | |
The following is an example of this error:
_asm mov eax, [ebx*2+ecx*4] |
|
C2431 | illegal index register in identifier |
The ESP register was scaled or used as both the index and base register. | |
The SIB encoding for the 80386 processor does not allow scaling by ESP or using ESP as both the index and base register. | |
The following examples cause this error:
_asm mov ax, [ESI+2*ESP] _asm mov ax, [esp+esp] |
|
C2432 | illegal reference to 16-bit data in identifier |
A 16-bit register was used as an index or base register. | |
The 32-bit targeted compiler does not support referencing 16-bit data, which is supported by the chip using the address size prefix. This means that 16-bit registers cannot be used as index or base registers if you are compiling for 32-bit code. | |
The following is an example of this error:
_asm mov eax, DWORD PTR [bx] |
|
C2433 | identifier : modifier not permitted on data declarations |
The specified modifier was used for a data declaration. | |
The friend, virtual, and inline modifiers cannot be used for data declarations. | |
C2434 | identifier : cannot convert the default parameter expression to type in formal parameter list |
The indicated default parameter could not be converted into the type specified in the function's formal parameter list. | |
This error can be caused by an incorrect function prototype or by using the wrong value for a default parameter. To use the indicated default parameter, you should define a conversion operator or a constructor that takes a single parameter of the same type as the specified default parameter. | |
The following is an example of this error. Note that if the conversion operator in A is supplied, then there is no error.
class A { public: int i; } a; class B { public: operator int() { return i; } // conversion operator int i; } b; void func1( int j = a ) {} // error, can't convert a to int void func2( int j = b ) {} // OK |
|
C2436 | identifier : cannot initialize member functions |
A member function of the specified class was initialized. | |
Unlike variables, functions cannot be initialized. This error can be caused by trying to initialize a function instead of a pointer to the function. | |
C2437 | identifier : already initialized |
The specified identifier was already initialized. | |
An object can be declared more than once but can be initialized only once. | |
C2438 | identifier : cannot initialize static class data via constructor |
A constructor was used to initialize a static member of a class. | |
Static members should be initialized in a definition outside of the class declaration. | |
The following example shows how static members are initialized:
class X { public: static const int i; static int j; }; const int X::i = 1; int X::j = 2; |
|
C2439 | identifier : member could not be initialized |
The indicated class, structure, or union member could not be initialized. | |
This error can be caused by trying to initialize an indirect base class or structure or an inherited member of a class or structure. An inherited member should be initialized by the constructor of the class or structure. | |
C2440 | identifier : cannot convert from type1 to type2 |
The indicated object could not be converted to the required type. | |
This error can be caused by converting a user-defined type to some other type without supplying a conversion operator. | |
A conversion operator should be supplied as shown in the following example for the class X, which returns an integer. Note that a parameter type or a return type is not specified.
class X { public: int j; } x; class Y { public: operator int() { return j; } // conversion operator int j; } y; void main() { int i; i = x; // error, x cannot be converted to an int i = y; // OK } |
|
C2441 | function : cannot use inline assembly in p-code function |
There was inline assembly-language code included in the given p-code function. Inline assembly cannot be used in a p-code function. | |
Turn p-code generation off for the given function by using:
#pragma optimize( "q", off ) |
|
or move the inline assembly-language code to a separate module that is not selected for p-code generation. | |
C2442 | p-code expression too complex for setjmp or Catch |
The setjmp function or Windows Catch function was included in a complicated expression in a p-code function. The setjmp and Catch functions can only be called from p-code with simple statements because these functions have a special meaning when called from the stack-based p-code interpreter. | |
Simplify the statement containing the setjmp or Catch function call. | |
C2443 | operand size conflict |
The instruction required operands of the same size. | |
One of the operands must be changed so that both operands have the same size. | |
The following is an example of this error:
short var; void main() { __asm xchg ax,bl // error __asm mov al,foo // error __asm mov al,BYTE PTR var // OK } |
|
C2446 | operator : no conversion between type1 and type2 |
The specified types could not be converted into the type required by the operator. | |
The following is an example of this error:
class C {}; class D {}; C aC; D aD; void main() { aC = aD; // error } |
|
C2447 | missing function header (old-style formal list?) |
An open curly brace ({) was found at global scope without a corresponding function header. | |
This error can be caused by using the old-style C-language formal list. | |
Check that the function being defined has an appropriate function declaration. | |
The following is an example of this error:
int c; {} // error |
|
C2448 | identifier : function-style initializer appears to be a function definition |
The specified function definition was incorrect. | |
This error can be caused by using the old-style C-language formal list. | |
The following is an example of this error:
void func(c) int c; {} // error |
|
C2450 | switch expression of type type is illegal |
The specified switch expression evaluated to an illegal type. | |
A switch expression must evaluate to an integral type or a class type that has an unambiguous conversion to an integral type. | |
If the expression evaluates to a user-defined type, a conversion operator needs to be supplied. | |
The following is an example of this error:
class X { public: int i; } x; class Y { public: int i; operator int() { return i; } // conversion operator } y; void main() { int j = 1; switch ( x ) // error, x is not type int { default: ; } switch ( y ) // OK { default: ; } } |
|
C2451 | conditional expression of type type is illegal |
The conditional expression evaluated to an illegal type. | |
The second and third operands (b and c) of the ternary operator (a ? b : c) must both be of the same type or must be able to be converted to a common type by standard conversions. | |
A conditional expression can be used as an l-value only if the second and third operands are of the same type and both are l-values. | |
C2458 | identifier : redefinition within definition |
The specified class, structure, union, or enumeration was redefined in its own declaration. | |
The following is an example of this error:
class C { enum i { C }; // error }; |
|
C2459 | identifier : is being defined; cannot add as an anonymous member |
The specified class, structure, or union was redefined in its own scope by a member of an anonymous union. | |
The following is an example of this error:
class C { union { int C; }; // error }; |
|
C2460 | identifier1 : uses identifier2, which is being defined |
The given class or structure (identifier2) was declared as a member of itself (identifier1). | |
Recursive definitions of classes and structures are not allowed. | |
The following is an example of this error:
class C { C aC; // error }; |
|
C2461 | class : constructor syntax missing formal parameters |
The constructor for the given class did not specify any formal parameters. The declaration of a constructor must specify a formal parameter list in parentheses. This list can be null. | |
Add a pair of parentheses after the class::class identifier. | |
The following is an example of this error:
class C { C::C; // error C::C(); // OK }; |
|
C2462 | identifier : cannot define a type while using new |
A type cannot be defined in the operand field of the new operator. | |
Put the type definition in a separate statement. | |
The following is an example of this error:
void main() { new struct S { int i; }; // error } |
|
C2463 | cannot define an anonymous type while using new |
An anonymous type cannot be defined in the operand field of the new operator. | |
Create a named type definition in a separate statement, then use the new operator. | |
The following is an example of this error:
void main() { new struct { int x; }; // error } |
|
C2464 | identifier : cannot use new to allocate a reference |
The specified reference identifier was allocated with the new operator. | |
Since references are not memory objects, the new operator cannot return a pointer to them. | |
Use the standard variable declaration syntax to declare a reference. | |
The following is an example of this error:
void main() { new ( int& ir ); // error } |
|
C2465 | cannot define an anonymous type inside parentheses |
An anonymous structure, union, or enumerated type was defined inside a parenthetical expression. | |
This is illegal in C++ programs, as the definition is meaningless in function scope. | |
C2500 | identifier1 : identifier2 is already a direct base class |
The specified class (or structure) appeared more than once in a list of base classes for a derived class. | |
A class is called a direct base if it is mentioned in the base list. A class is called an indirect base if it is not a direct base but is a base class of one of the classes mentioned in the base list. | |
A class cannot be specifed as a direct base class more than once. A class can be used as an indirect base class more than once. | |
The following is an example of this error:
class A { }; class B : public A, public A { }; // error class C : public A { }; class D : public A { }; class E : public C, public D { }; // OK, contains two As |
|
C2501 | identifier : missing decl specifiers |
The identifier was declared without specifying its type. | |
This error occurs when a type specifier is omitted in the declaration of an identifier. | |
C2502 | identifier : too many access modifiers on the base class |
The specified base class had more than one access modifier. | |
A base class or structure can be declared with only one access modifier (public, private, or protected). | |
The following is an example of this error:
class A { }; class B { }; class C : private public A { }; // error class D : private A { }; // OK class E : public A, private B { }; // OK |
|
C2503 | class : base classes cannot contain zero-sized arrays |
The specified base class (or structure) contained a zero-sized array. | |
An array in a class must have at least one element. | |
C2504 | class : base class undefined |
The specified base class was declared but never defined. | |
This error can be caused by a missing include file or an external base class that was not declared with the extern specifier. | |
The following is an example of this error:
class A; // error, A is undefined class A {}; // OK, A is defined class B : public A {}; // the error is detected here |
|
C2505 | identifier : is not a legal base class |
The specified identifier was not a class (or structure) but was used to derive a class. | |
A class can be derived only from classes. This error can be caused by naming a variable or type in the base class list. | |
The following is an example of this error:
class B { }; class D : public B { }; // OK, D is derived from B typedef int I; class E : public I { }; // error, I is not a class |
|
C2506 | class::identifier : ambiguous |
The specified name referred to more than one class member. | |
To access a base class or structure, an expression must refer to one unique function, object, type, or enumerator. The scope resolution operator (::) can be used to resolve the ambiguity. | |
The check for ambiguity is done before access control. A private base class containing only private members has the same potential for ambiguity as a public class. | |
The following is an example of this error:
class A { public: int a; }; class B { private: int a; }; class C : public A, private B { }; C c; int j = c.a; // error, could be A::a or B::a int i = c.A::a; // OK, resolved ambiguity |
|
C2507 | identifier : too many virtual modifiers on the base class |
The specified class or structure was declared as virtual more than once. | |
Only one virtual modifier can be used for each base class in a list of base classes. | |
The following is an example of this error:
class A {}; class B : virtual virtual public A {}; // error class C : virtual public A {}; // OK |
|
C2508 | identifier : access denied |
The specified nonpublic class member could not be accessed. | |
A class (or structure or union) member that has been declared with private or protected access can only be accessed by member functions of the class. | |
C2509 | identifier : member function not declared in class |
The function was not declared in the specified class. | |
This error can be caused by specifying the wrong class when calling the function. | |
C2510 | identifier : left side of '::' must be a class/struct/union |
The named identifier was not a class, structure, or union. | |
A class, structure, or union name must appear on the left side of the scope resolution operator (::) if any name is used. | |
C2511 | identifier : overloaded member function not found in class |
The specified function was not declared for the given parameters. | |
This error can be caused by a mismatch in the parameter list of the specified function. | |
C2512 | identifier : no appropriate default constructor available |
No default constructor was available for the specified class, structure, or union. | |
The compiler will supply a default constructor only if user-defined constructors are not provided. If you provide a constructor that takes a nonvoid parameter, then you must also provide a default constructor. The default constructor can be called with no parameters, that is, a constructor with default values for all parameters. | |
C2514 | class : class has no constructors |
The specified class was initialized with parameters for which no constructor was defined. | |
Constructors must be declared with parameter lists that match every parameter list used to initialize objects of the class, structure, or union. | |
C2515 | identifier : not in class class |
The specified identifier was not a member of the given class. | |
C2517 | identifier : right side of '::' is undefined |
The identifier on the right side of the scope resolution operator (::) was not defined. | |
The identifier on the right side of the scope resolution operator must be a defined member of the class, structure, or union found on the left side of the operator. If no class, structure, or union is named, then the identifier on the right side of the operator must be declared with global scope. | |
C2519 | cannot convert type1 * to type2 * |
A pointer to type1 could not be converted to a pointer to type2. | |
Since type1 was not derived from type2, implicit conversion was not possible. | |
A pointer to one type generally cannot be implicitly converted to a pointer to another type. Conversion to a void * is possible if the size of void * is greater than the size of the original pointer. | |
If a pointer to one type must be converted to a pointer to another type, then explicit conversion should be used. | |
C2523 | identifier1::~identifier2 : destructor tag mismatch |
A destructor for the specified class was declared with a different name. | |
The destructor for a class must have the same name as the class itself and must be preceded by a tilde (~). | |
The constructor and destructor are the only members of a class that have the same name as the class. | |
C2524 | identifier : destructors must have a void formal parameter list |
The specified destructor had a nonvoid formal parameter list. | |
A destructor can take only a void parameter. Other parameter types are not allowed. | |
C2527 | identifier : array of references must be fully initialized |
Elements of the specified array were not initialized. | |
An initializer must be supplied for every element of an array of references. | |
The following is an example of this error:
int a, b, c; int &ai[3]; // error, elements not initialized int &ai[3] = { a, b, c }; // OK |
|
C2528 | illegal pointer to a reference |
A pointer to a reference was declared. | |
The variable must be dereferenced before a pointer to it can be declared. | |
C2529 | illegal reference to a reference |
A reference to a reference was declared. | |
This error can be avoided by using pointer syntax and declaring a reference to a pointer. | |
C2530 | identifier : references must be initialized |
A reference was not initialized when it was declared. | |
The following cases are the only times a reference can be declared without initialization:
It is declared with the keyword extern. It is a member of a class, structure, or union and is initialized in the class's constructor function. It is declared as a parameter in a function declaration or definition. It is declared as the return type of a function. |
|
C2531 | identifier : reference to a bit field illegal |
A reference to the specified bit field was declared. | |
A reference to a bit field is not allowed. | |
C2532 | identifier : cannot modify references |
The specified reference was changed. | |
References cannot be modified to refer to another object. | |
If the reference must be modified, then it should be implemented as a pointer instead. | |
C2533 | identifier : constructors not allowed a return type |
The specified constructor was declared with a return type. | |
A constructor does not return a value and has no return type. A return type of void is not allowed. | |
The following is an example of this error.
class X { public: void X( void ) { ... }; // error, return type declared X( void ) { ... }; // OK, no return type declared }; |
|
C2534 | identifier : constructor cannot return a value |
The specified constructor cannot return a value. | |
A constructor cannot return a value of any type, including a return type of void. | |
This error can be eliminated by removing the return statement from the constructor definition. | |
C2535 | identifier : member function already defined or declared |
The specified member function was defined or declared earlier. | |
This error can be caused by repeating the same formal parameter list in more than one function definition or declaration. | |
C2536 | identifier1::identifier2 : cannot specify explicit initializer for arrays |
The specified member of a class, structure, or union could not be initialized. | |
This error can be caused if a constructor is not available to initialize one or more members of an array. If the size of the array is greater than the number of initial-izers, then a default constructor must be defined. | |
Alternatively, this error can be caused by declaring a nonstatic array with the const specifier. This kind of array cannot be explicitly initialized. | |
C2537 | identifier : illegal linkage specification |
The indicated linkage specifier was not legal. | |
This error can be caused by using a linkage specifier that is not supported. Only the “C” linkage specifier is supported. | |
This error can also be caused by overloading more than one function with “C” linkage. Only one of a set of overloaded functions can be declared with “C” linkage. | |
C2538 | new : cannot specify initializer for arrays |
An initializer was given for the specified array created with the new operator. | |
The new operator creates arrays of objects by calling the default constructor for each element of the array. The elements of the array cannot be initialized to distinct values. | |
C2539 | new : identifier : no default constructor to initialize array of objects |
A default constructor was not available to initialize an array of objects of the specified class, structure, or union. | |
Initializing an array of objects requires a default constructor. The default constructor is called separately for each object in the array. | |
This error can be caused by not defining a default constructor. If any constructor is defined, then the compiler will not generate a default constructor. A default constructor (one that can be called with no parameters) must be explicitly defined in this case. | |
C2540 | nonconstant expression as array bound |
The specified array bound was not a constant expression. | |
An array must be declared with a constant bound. | |
The following example shows an illegal way to declare an array:
int i; int A[i]; // error, i is nonconstant |
|
and legal ways to declare an array:
const j = 20; int A[j]; // OK, j is constant int B[32]; // OK, 32 is a literal |
|
C2541 | delete : cannot delete nonpointer objects |
The delete operator was used on an object that was not a pointer. | |
The delete operator can only be used on pointers. | |
The following is an example of this error:
void main() { int i; delete i; // error, i is not a pointer int* ip = new int; delete ip; // OK } |
|
C2542 | identifier : class object has no constructor for initialization |
There was no constructor to initialize the specified object. | |
A constructor with the same parameter list used in the initialization must be supplied. | |
This error can also be caused by initializing an object with incorrect parameters. | |
C2543 | expected ']' for operator '[]' |
The left square bracket (]) of the subscripting operator was missing. | |
This error can be caused by expansion of a macro. | |
C2544 | expected ')' for operator '()' |
The left parenthesis of the function call operator was missing. | |
This error can be caused by expansion of a macro. | |
C2545 | identifier : unable to find overloaded operator |
The specified operator could not be used with the provided operands. | |
An overloaded operator should be supplied with the required operands. | |
This error can be caused by using the operator with operands of the incorrect type. Defining a conversion operator or a constructor that takes a single parameter may allow the operator to be used. | |
C2546 | operator : illegal mix of void pointer with nonvoid pointer |
The specified operator was called with incompatible pointer types. | |
This error can be caused by using an arithmetic operator on a void pointer. Pointer arithmetic can only be done with pointers to objects. | |
If the operator must be used with a void pointer, then the operator can be overloaded. Alternatively, cast the void pointer into a type that can be used with the specified operator. | |
C2547 | illegal cast of overloaded function |
A pointer to a function type was converted to an overloaded type. | |
Conversion of a pointer to a function into a pointer to an overloaded function is not allowed. | |
The following is an example of this error:
int func(); int func( int ); ( int (*)() )func; // error, func is overloaded int func2(); ( void (*)() )func2; // OK, func2 is not overloaded |
|
C2548 | identifier1::identifier2 : missing default parameter for parameter identifier3 |
A parameter was missing in a default parameter list. | |
If a default parameter is supplied anywhere in a parameter list, then all subsequent parameters on the right side of the default parameter must also be defined. | |
The following is an example of this error:
void func( int = 1, int, int = 3); // error void func( int, int, int = 3); // OK void func( int, int = 2, int = 3); // OK |
|
C2549 | user-defined conversion cannot specify return type |
A user-defined conversion cannot specify a return type. | |
The following is an example of this error:
class X { public: int operator int() { return value; } // error operator int() { return value; } // OK private: int value; }; |
|
C2551 | void * type needs explicit cast to nonvoid pointer type |
A void pointer was assigned to a nonvoid pointer by implicit conversion. | |
An explicit cast is necessary to convert a void pointer to a nonvoid pointer. | |
C2552 | identifier : nonaggregates cannot be initialized with initializer list |
The specified identifier was incorrectly initialized. | |
An initializer list is needed to initialize the following types:
An array A class, structure, or union that does not have constructors, private or protected members, base classes, or virtual functions |
|
These types are known as “aggregates.” | |
C2553 | no legal conversion of return value to return type type |
The return value could not be converted to the required type. | |
You may need to supply a user-defined conversion operator to cast the return value. | |
C2555 | identifier1::identifier2 : overriding virtual function differs only by return type |
The specified virtual function and a derived overriding function had identical parameter lists but different return types. | |
An overriding function in a derived class cannot be redefined to differ only by its return type from a virtual function in a base class. | |
A function in a derived class or structure overrides a virtual function in a base class only if their names, parameters, and return values are all identical. (If the functions have different parameters, then the compiler treats them as different functions and does not override the virtual function.) | |
It may be necessary to cast the return value after the virtual function has been called. | |
C2556 | identifier : overloaded functions only differ by return type |
The indicated overloaded functions had different return types but the same parameter list. | |
Each overloaded function must have a distinctly different formal parameter list. | |
C2557 | identifier : nonpublic members initialized without constructor |
Private and protected members cannot be assigned a value except by the class's member or friend functions. These members should be initialized in the class constructor. | |
C2558 | identifier : no copy constructor available |
No copy constructor was defined to copy the specified class. | |
A copy constructor is used to initialize an object with the values of another object of the same type, that is, to make a copy of the object. | |
If no copy constructor is provided, the compiler will generate a default copy constructor. A default copy constructor is not generated by the compiler if any user-defined copy constructor has been defined. | |
C2559 | identifier : no match for specified operator |
There was an attempt to use the new operator to call the constructor for the given identifier, but there was no constructor that corresponded to the given ambient memory model or distance. | |
Make sure that the appropriate constructors have been defined for each memory model or distance being used. | |
C2561 | identifier : function must return a value |
The specified function was declared as returning a value, but the function definition did not contain a return statement. | |
This error can be caused by an incorrect function prototype. If the function does not return a value, the function should be declared with a void return type. | |
C2562 | identifier : void function returning a value |
The indicated function was declared as a void function but returned a value. | |
This error can be caused by an incorrect function prototype. If the function returns a value, the return type must be specified in the function declaration. | |
C2563 | mismatch in formal parameter list |
The formal parameter list of a function or pointer to a function did not match those of another function or pointer to a member function, respectively. | |
The assignment of the functions or pointers could not be made because of incompatible declarations. | |
The following is an example of this error:
void func( int ); void func( int, int ); main() { void *fp(); fp = func; // error fp = func( int, int ); // OK } |
|
C2564 | formal/actual parameter mismatch in call through pointer to function |
The formal parameters in the function declaration did not match the actual parameters passed through the pointer to the function. | |
C2565 | ::identifier was previously declared as a global function |
The indicated member function had the same name as a function declared earlier with global scope. | |
C2566 | overloaded function in a conditional expression |
The overloaded function in a conditional expression could not be evaluated. | |
The following is an example of this error:
int f( int ); int f( double ); void main() { if( f ); // error, which f? if( f(1) ); // OK } |
|
C2568 | identifier1 : unable to resolve function overload identifier2 |
The compiler could not unambiguously determine which of the specified overloaded functions to call. | |
The actual parameters passed to the function should be cast to match the formal parameters listed in the declaration of one of the specified functions. One parameter match must be better than any of the other possible matches. | |
C2569 | identifier : union cannot be used as a base class |
A class was derived from the specified union. | |
A union is not allowed to be a base class. If a new user-defined type must be derived from the specified union, the union should be changed to a class or structure. | |
C2570 | identifier : union cannot have base classes |
A union was derived from a class, structure, or union. | |
The derived user-defined type must be declared as a class or structure. | |
C2571 | identifier : union cannot have virtual function identifier |
The specified union was declared to have a virtual function. | |
Virtual functions can only be used with a class or structure but not with a union. Change the specified union to a class or structure or make it a nonvirtual function. | |
C2572 | identifier1::identifier2 : redefinition of default parameter : parameter identifier3 |
The specified default parameter in a member function was redefined. | |
A default parameter cannot be redefined. If a new value for the parameter is required, then the default parameter should be left undefined. | |
C2573 | identifier : simple type cast must have exactly one expression |
The specified conversion had a wrong number of actual parameters. | |
The following is an example of this error:
void func() { int i = int(); // error, no actual parameters int j = int( 1.0 ) // OK } |
|
C2574 | identifier : illegal static destructor declaration |
The specified destructor was declared as static. | |
Destructors cannot be declared as static. | |
C2575 | identifier : only member functions and bases can be virtual |
The specified global function or class was declared as virtual. | |
The keyword virtual refers only to members of a class or structure. A global function or a class or structure that is not a base class cannot be declared as virtual. | |
C2576 | identifier : virtual specifier used for static member function |
A static member function was declared as virtual. | |
The virtual function mechanism relies on the specific object that calls the function to determine which virtual function is used. Since this is not possible for static functions, they cannot be declared as virtual. | |
C2577 | identifier : destructor cannot return a value |
The specified destructor returned a value. | |
A destructor cannot return a value of any type. This error is caused by defining a destructor that returns a value of any type, including a void return type. | |
This error can be eliminated by removing the return statement from the destructor definition. | |
C2579 | identifier1::identifier2(identifier3) : parameter list not sufficiently different from identifier1::identifier2(identifier4) |
The parameter lists for the specified functions were not sufficiently different. | |
The formal parameter lists of overloaded functions must all be different. | |
C2580 | redefinition of class name identifier |
The specified class, structure, or union was already defined. | |
A class, structure, or union can be defined only once. | |
C2581 | identifier : static operator= function is illegal |
The assignment operator, operator=(), was declared as static. | |
The assignment operator cannot be declared as static. | |
C2582 | identifier : operator= function is unavailable |
No assignment operator, operator=(), was defined for the specified class. | |
If any assignment operator has been defined that takes the class as a parameter, then a default assignment operator will not be generated by the compiler. The assignment operator must be explicitly defined for each class and is not inherited by derived classes. | |
C2583 | identifier : illegal const/volatile this pointer used for constructors/destructors |
A constructor or destructor was declared with a const or volatile specifier. | |
The const and volatile declaration specifiers cannot be used for constructors or destructors. | |
C2584 | identifier1 : direct base identifier2 is inaccessible; already a base of identifier3 |
The specified derived class (identifier1) was derived from a direct base class (identifier3) that was already a base class of the derived class (identifier2). | |
A class (or structure) cannot use the same class more than once as a direct base class (a class mentioned in the list of base classes for the derived class). A base class can be used more than once as an indirect base class (a class not in the list of base classes). | |
C2585 | explicit conversion to type is ambiguous |
The type conversion could produce more than one result. | |
Ambiguous conversion can result when converting from a class (or structure) type based on multiple inheritance. If the same base class is inherited more than once, the conversion function or operator must specify which of the inherited classes to use in the conversion. The scope resolution operator (::) can be used to do this. | |
Ambiguous conversion can also be caused when a conversion operator and a constructor making the same conversion have been defined. | |
C2586 | incorrect user-defined conversion syntax : illegal indirections |
Indirection of a conversion operator is not allowed. | |
The following is an example of this error:
class C { * operator int(); // error, indirection on the operator }; typedef int * pINT_t; class D { operator pINT_t(); // OK }; |
|
C2587 | identifier : illegal use of local variable as default parameter |
A local variable was illegally used as a default parameter. | |
The following is an example of this error:
int i; void func(); { int j; extern void func2( int k = j ); // error, local variable extern void func2( int k = i ); // OK } |
|
C2588 | ::~identifier : illegal global destructor |
The specified destructor was not defined for a class, structure, or union. | |
A destructor can be defined only for a class, structure, or union. | |
This error can be caused by omitting the name of a class, structure, or union on the left side of the scope resolution operator (::). | |
The following is an example of this error:
~F(); // error |
|
C2589 | identifier : illegal token on right side of '::' |
The token on the right side of the scope resolution operator (::) was not legal. | |
Only a member of a class (or structure or union) can be on the right side of the scope resolution operator if a class name is on the left side. Otherwise, any global identifier can be on the right side. | |
C2590 | identifier : ambiguous user-defined conversions in switch expression |
The specified switch expression could not be converted to an integral type. | |
An expression in a switch expression must unambiguously convert to an integral type. | |
Ambiguous conversion can be caused when a conversion operator and a constructor making the same conversion have been defined. | |
C2591 | identifier : ambiguous user-defined conversions in conditional expression |
The specified conditional expression could not be converted to an integral type. | |
An expression in a conditional expression must unambiguously convert to an integral type. | |
Ambiguous conversion can be caused when a conversion operator and a constructor making the same conversion have been defined. | |
C2592 | no legal conversion of initialization expression to type type |
The value of the initialization expression could not be converted to the specified type. | |
A conversion operator may need to be supplied to make the required cast. | |
C2595 | identifier : qualified name already has a constructor |
A constructor was already defined for the specified nested class, structure, or union. | |
Only one constructor can be defined for a class, structure, or union. | |
C2596 | identifier : qualified name already has a destructor |
A destructor was already defined for the specified nested class, structure, or union. | |
Only one destructor can be defined for a class, structure, or union. | |
C2597 | identifier : does not specify an object |
The specified identifier was not a member of a class, structure, or union. | |
A member access operator (. or –>) was used to refer to a function that was not defined as a member of the class, structure, or union. | |
C2598 | linkage specification must be at global scope |
The linkage specifier was declared in local scope. | |
The following is an example of this error:
void func() { extern "C" int func2(); // error, linkage declared in . // block with local scope . . } extern "C" int func( int i ); // OK |
|
C2601 | functions cannot be defined in local classes |
A function definition was found in a class definition. | |
A function cannot be declared as local to a class, structure, or union. | |
The following is an example of this error:
void main() { class C { int f() { return 0; } // error, local function }; } |
|
C2607 | identifier : cannot implicitly convert a type1 to a nonconst type2 |
The specified type was converted to a nonconst type type2. | |
The initializer for a reference to type2 must be one of the following:
An l-value of type type2 A type derived from type2 for which type2 is an accessible base |
|
If the reference is to a const type, then an object of that type will be created and initialized with the initializer. A temporary object of type type2 was required but could not be initialized with a nonconst reference type2&. | |
C2608 | illegal reference cast—operand not an l-value |
The reference could not be cast. | |
This error occurs when a temporary copy of the referenced value cannot be generated. | |
The following is an example of this error:
struct C { int mem; operator int(); }; struct D { operator C(); void memfunc(); }; D aD[10]; void D::memfunc() { C aC = ( C& )( aD + 1 ); // error } |
|
C2610 | identifier identifier can never be instantiated; user-defined constructor is required |
The specified class cannot be properly initialzied. | |
This error occurs when a constructor cannot be created for the class. A user-defined constructor should be defined. | |
C2611 | token : illegal following '~' (expected identifier) |
The specified token was not an identifier. | |
The following is an example of this error:
class C { C::~operator int(); // error ~C(); // OK, destructor declaration }; |
|
C2612 | trailing ',' illegal in base/member initializer list |
A comma (,) was placed after the last base or member in an initializer list. | |
The following is an example of this error:
class A { public: int i; A( int ia ) : i( ia ), {}; // error, extra comma A( int ia ) : i( ia ) {}; // OK }; |
|
C2613 | trailing ',' illegal in base class list |
A comma (,) was placed after the last base in a base class list. | |
The following is an example of this error:
class A {}; class B : public A, {}; // error, extra comma class C : public A {}; // OK |
|
C2614 | class1 : illegal member initialization: class2 is not a base or member |
A class in an initialization list was not a base class or member. | |
Only a member or base class can be in the initialization list for a class or structure. | |
The following is an example of this error:
class A { public: int i; A( int ia ) : B( i ) {}; // error, B is not a member of A }; |
|
C2616 | cannot change member's access |
The access of the specified identifier was changed outside of its class declaration. | |
Access to members of a class (or structure or union) can only be specified in the declaration of the class to which they belong. | |
The following is an example of this error:
class A { public: int i; }; class B { private: A::i; // error, A::i is not a member of B }; |
|
C2617 | function : inconsistent return statement |
The specified function did not have a return type declared, and a previous return statement did not supply a value. | |
The function return type should be declared. | |
The following is an example of this error:
int i; func() // no return type prototype { if( i ) return; // no return value else return( 1 ); // error detected on this line } |
|
C2618 | function : inconsistent return statement |
The specified function did not have a return type declared, and a previous return statement had a different type. | |
The function return type should be declared. | |
The following is an example of this error:
int i; func() // no return type prototype { if( i ) return( 1 ); // int return value else return; // error detected on this line } |
|
C2619 | union union : cannot have static member variable identifier |
The specified union member was declared as static. | |
A union cannot have a static data member. | |
The following is an example of this error:
void func() { union { static int j; // error, j is static int i; // OK }; } |
|
C2620 | union union : member identifier has default constructor |
The specified union member was declared with a default constructor. | |
A union member is not allowed to have a default constructor. | |
The following is an example of this error:
class A { A(); // A has a default constructor }; union U { A a; // error }; |
|
C2621 | union union : member identifier has a copy constructor |
The specified union member was declared with a copy constructor. | |
A union member is not allowed to have a copy constructor. | |
The following is an example of this error:
class A { A( const A& ); // A has a copy constructor }; union U { A a; // error }; |
|
C2622 | union union : member identifier has assignment operator |
The specified union member was declared with an assignment operator, operator=(). | |
A union member is not allowed to have an assignment operator. | |
The following is an example of this error:
class A { operator= ( const A& ); // A's assignment operator }; union U { ; // error }; |
|
C2623 | union union : member identifier has a destructor |
The specified union member was declared with a destructor. | |
A union member is not allowed to have a destructor. | |
The following is an example of this error:
class A { ~A(); // A has a destructor }; union U { A a; // error }; |
|
C2624 | identifier : references to void are illegal |
The specified identifier was declared as a reference to void. | |
References to void are not allowed. | |
C2625 | anonymous union did not declare any nonstatic data members |
Unions cannot have static data members. | |
The following is an example of this error:
static union {}; // error static union { int i; }; // OK |
|
C2626 | anonymous union defines protected/private member identifier |
The specified member was declared with protected or private access. | |
A member of an anonymous union must have public access. | |
The following is an example of this error:
void main() { union { public: int i; // OK, i is public protected: int j; // error, j is protected private: int k; // error, k is private }; } |
|
C2627 | anonymous union defines member function function |
The specified function was declared in an anonymous union. | |
An anonymous union cannot have member functions. | |
The following is an example of this error:
void main() { union { int i; void func( void ); // error, union is anonymous }; union U { void func2( void ); // OK }; } |
|
C2628 | type1 followed by type2 is illegal (is a “;” missing?) |
A section of code between the two specified types was incorrect. | |
This error can be caused by a missing semicolon. | |
The following is an example of this error:
class C { public: void func( void ) {;} } // semicolon is missing here void main() {} // error detected on this line |
|
C2629 | unexpected token ( |
A syntax error made the statement ambiguous. | |
This error can be caused by mixing declaration and expression syntax. | |
The following is an example of this error:
class B { B( &B ); // error, misplaced & B( B& ); // OK }; |
|
C2631 | class : destructors not allowed a return type |
A destructor in the specified class, structure, or union was declared with a return type. | |
A destructor cannot be declared with a return type. | |
The following is an example of this error:
class C { int ~C(); // error, returns int void ~C(); // error, returns void ~C(); // OK }; |
|
C2632 | type1 followed by type2 is illegal |
Two type specifiers had missing code between them. | |
The following is an example of this error:
int float i; // error |
|
C2633 | identifier : inline is the only legal storage class for constructors |
The constructor was declared as other than inline. | |
The following is an example of this error:
class C { extern C(); // error, not inline }; |
|
C2635 | cannot convert an identifier1* to an identifier2*; conversion from a virtual base class is implied |
The specified conversion required a cast from a virtual base class to a derived class. | |
Casting from a virtual base class to a derived class is not allowed. | |
C2636 | pointer to reference member is illegal |
A pointer to a reference member was declared. | |
The following is an example of this error:
struct S {}; int &S::*prs; // error |
|
C2637 | identifier : cannot modify pointers to data members |
The specified pointer to a data member was modified. | |
The following is an example of this error:
struct S {}; int __pascal S::*pms; // error |
|
C2638 | identifier : memory-model modifier illegal on pointer to data member |
A memory-model modifier was specifed for a pointer to a data member. | |
Memory-model modifiers can only be used for pointers to member functions. | |
The following is an example of this error:
class C { public: int i; int j; int func(); }; int __near C::* cpi = &C::i; // error, __near modifier int C::* cpj = &C::j; //OK int (__near C::* cpf)() = &C::func; // OK, not data member |
|
C2639 | cannot use pointer to member expression &class::member—base class is inherited as virtual |
The pointer to the specified member was illegally inherited as virtual from the specifed base class or structure. | |
Pointers cannot point to members of derived classes that are inherited as virtual members. | |
The following is an example of this error:
struct V { virtual void func(); }; struct D : virtual V { void func(); }; void main() { &D::func; // error } |
|
C2640 | cannot convert a pointer to member across a virtual inheritance path |
A pointer to a member was illegally cast to a pointer to a member of a base class that is declared as virtual. | |
The following is an example of this error:
class A { public: int a; }; class B { public: int b; }; class C : virtual public A, public B {}; int C::* cpa = &C::a; // error, C's A is virtual int C::* cpb = &C::b; // OK |
|
C2641 | illegal pointer to member cast across virtual inheritance path |
A pointer to a member was cast to a base class that was inherited using virtual inheritance. | |
The following is an example of this error:
struct V {}; struct A : virtual V {}; int A::*pma; int V::*pmv = (int V::*)pma; |
|
C2642 | cast to pointer to member must be from related pointer to member |
A pointer to a member was cast to a pointer to a member of a class (or structure) that was not a derived or base class. | |
The following is an example of this error:
class B { public: int b: }; class C {}; int C:: cpb = (int C::*)&B::b; // error class D : public B { public: int d; }; int D:: dpb = (int D::*)&B::b; // OK, B is a base class of D int B:: bpd = (int B::*)&D::d; // OK |
|
C2643 | illegal cast from pointer to member |
A pointer to a member of a class, structure, or union was cast to a different type. | |
The following is an example of this error:
class C { public: int i; operator int*() { return &i; } }; int C::* cpi = (int*)&C::i; // error int C::* cpi2 = &C::i; // OK |
|
C2644 | basis class class for pointer to member has not been defined |
A pointer was declared that pointed to a class that was declared but not defined. | |
The following is an example of this error:
class C; int C::* cp; // error, C has not been declared class D {}; int D::*dp; // OK |
|
C2645 | no qualified name for pointer to member (found ':: *') |
The pointer to member declaration did not specify a class. | |
The declaration of a pointer to a member of a class (or structure or union) must specify the name of the class. | |
The following is an example of this error:
class A {}; int ::* cp; // error, class not specifed int B::* bp // error, B not defined int A::* ap; // OK |
|
C2646 | global anonymous unions must be declared static |
The anonymous union had global scope but was not declared as static. | |
The following is an example of this error:
union { int i; }; // error, not static static union { int j; }; // OK union U { int i; }; // OK, not anonymous |
|
C2648 | identifier : use of nonstatic member as default parameter |
The specified nonstatic member was used as a default parameter. | |
The following is an example of this error:
class C { public: int i; static int j; void func1( int i = i ); // error, i is not static void func2( int i = j ); // OK, uses static j }; |
|
C2649 | identifier : is not a class-key |
The specified class, structure, or union declaration used an incorrect tag. | |
The following is an example of this error:
struct S { int i; }; class S::i c; // error |
|
C2650 | operator : cannot be a virtual function |
The specified operator was declared as virtual. | |
The operators new and delete cannot be virtual because they are static member functions. | |
The following is an example of this error:
class A { virtual void* operator new( unsigned int ); // error }; |
|
C2652 | identifier : illegal copy constructor : first parameter must not be an identifier |
The first parameter in the specified copy constructor was the same type as the class, structure, or union for which it was defined. | |
A copy constructor for a type can take a reference to the type as the first parameter but not the type itself. | |
The following is an example of this error:
class A { A( A ); // error, takes an A }; class B { B( B& ); // OK, reference to B }; |
|
C2653 | identifier : is not a class |
The specified identifier was not a class, structure, or union. | |
An identifier that was not a class, structure, or union was accessed using incorrect syntax. | |
The following is an example of this error:
int x; int main() { return x::i; // error } |
|
C2654 | identifier : attempt to access member outside a member function |
The specifed identifier was accessed in a declaration. | |
Member data can only be accessed in member functions. | |
This error can be caused by trying to initialize variables in a declaration. A constructor should be used for this purpose. | |
The following is an example of this error:
class A { int i; int j = i; // error, access outside function void setj( void ) { j = i ; } // OK, access in function A( int ai ) { i = ai; // OK, initializes i and j j = i; } } a( 1 ); |
|
C2655 | identifier : definition or redeclaration illegal in current scope |
The specified identifier was redeclared or redefined in nonglobal scope. | |
An identifier can only be redeclared in global scope. | |
The following is an example of this error:
class A {}; class B { public: static int i; }; void main() { A B::i; // error } |
|
C2656 | function : function not allowed as a bit field |
The specified function was declared as a member of a bit field. | |
This error can be caused by a syntax error in a constructor initializer list. | |
C2657 | class::* found at the start of a statement (was a type specified?) |
The line began with the specified pointer to member identifier. | |
This error can be caused by omitting a type specifier in the declaration of a pointer to a member. | |
The following is an example of this error:
class C {}; void main() { C::* pmc1; // error void C::* pmc2; // OK } |
|
C2658 | multiple conversions: type1(type2) and type1::operator type2() |
The conversion was ambiguous because it could be done with either the specified constuctor or the specifed conversion operator. | |
The following is an example of this error:
struct A; struct B { B(A); B(); }; struct A { operator B(); }; A a; B b = B(a); // error |
|
C2659 | operator : overloaded function as left operand |
An overloaded function was on the left side of the specified operator. | |
The following is an example of this error:
int func( int ); int func( double ); void main() { func = 10; // error } |
|
C2660 | function : function does not take number parameters |
The specified function was called with an incorrect number of actual parameters. | |
This error can be caused by calling the function with incorrect actual parameters or by omitting a function declaration. | |
The following is an example of this error:
void func( int, int ); void main() { func( 1 ); // error, func( int ) not declared func( 1, 0 ); // OK, func( int, int ) was declared } |
|
C2661 | function : no overloaded function takes number parameters |
The specified overloaded function was not declared for the given number of parameters. | |
This error can be caused by calling the function with incorrect actual parameters or by omitting a function declaration. | |
The following is an example of this error:
void func( int ); void func( int, int ); void main() { func( ); // error, func( void ) was not declared func( 1 ); // OK, func( int ) was declared } |
|
C2662 | function : no legal conversion for the this pointer |
The required conversion for the this pointer was not defined. | |
A user-defined conversion operator may be required. | |
The following is an example of this error:
class __far C { public: void func() __near; } c; void main() { c.func(); // error } |
|
C2663 | function : number overloads had no legal conversion for the this pointer |
The required conversion was not defined for the this pointer to the specified overloaded functions. | |
A user-defined conversion operator may be required. | |
The following is an example of this error:
class __far C { public: void func() __near; void func( int ) __near; } c; void main() { c.func(); // error } |
|
C2664 | function : no legal conversion for parameter number |
The specified parameter of the specified function could not be converted to the required type. | |
An explicit conversion may need to be supplied. | |
The following is an example of this error:
class A {} a; func( int, A ); void main() { func( 1, 1 ); // error, no conversion from A to int } |
|
C2665 | function : number1 overloads have no legal conversion for parameter number2 |
The specified parameter of the overloaded function could not be converted to the required type. | |
A conversion operator or explicit conversion may need to be supplied. | |
C2666 | identifier : number overloads have similar conversions |
The specified overloaded function or operator was ambiguous. | |
This error is caused by formal parameter lists that are too similar to resolve ambiguity. | |
An explicit cast of one or more of the actual parameters can resolve the ambiguity. | |
The following is an example of this error:
void func( int, float ) {}; void func( float, int ) {}; func( 1, 1 ); // error, same conversion for each func func( 1, (float)1 ) // OK |
|
C2667 | function : none of number overloads have a best conversion |
The specified overloaded ambiguous function call could not be resolved. | |
The conversion required to match the actual parameters in the function call to one of the overloaded functions must be strictly better than the conversions required by all of the other overloaded functions. | |
C2668 | function : ambiguous call to overloaded function |
The specified overloaded function call could not be resolved. | |
An explicit cast of one or more of the actual parameters can resolve the ambiguity. | |
The following is an example of this error:
struct A {}; struct B : A {}; struct X {}; struct D : B, X {}; void func( X, X ); void func( A, B ); D d; void main() { func( d, d ); // error, D has an A, B, and X func( (X)d, (X)d ); // OK, uses func( X, X ) } |
|
C2671 | function : static member functions do not have this pointers |
The specified static member function could not access a this pointer. | |
The following is an example of this error:
struct S { static S* const func() { return this; } // error }; |
|
C2672 | function : new/delete member functions do not have this pointers |
The specified new or delete operator did not have a this pointer to access. | |
The following is an example of this error:
class C { void* operator new( unsigned int ) { this = 10; // error return 0; } }; |
|
C2673 | function : global functions do not have this pointers |
The specified global function did not have a this pointer to access. | |
The following is an example of this error:
void main() { this = 0; // error } |
|
C2710 | cannot delete a pointer to a const object |
A pointer to an object declared as const was illegally deleted using the delete operator. | |
The following is an example of this error:
const int* pci; const int i = 0; void main() { pci = &i; delete pci; // error, pci points to a const } |
|
C2711 | cannot delete a pointer to a function |
A pointer to a function was illegally deleted using the delete operator. | |
The following is an example of this error:
void (*pf)(); void func(); void main() { pf = func; delete pf; // error, pf points to a function } |
|
C2720 | identifier : specifier storage class specifier illegal on members |
A storage class was illegally specified for the given identifier. | |
The following is an example of this error:
struct S { static int i; }; static S::i; // error |
|
C2721 | specifier : storage class specifier illegal between operator keyword and type |
A type conversion cannot specify a storage class. User-defined type conversions apply to all storage classes. | |
C2722 | ::operator : illegal following operator command; use operator operator |
Either ::new or ::delete was redefined using the operator statement. Since the new and delete operators are global, the scope resolution operator (::) is meaningless in this context. | |
Remove the scope resolution operator preceding the given operator. | |
C2730 | class : cannot be a base class of itself |
Recursive base classes are illegal. | |
Remove the base class specifier, or specify another class as a base class. | |
C2732 | linkage specification contradicts earlier specification for function |
The specified function was already declared with a different linkage specifier. | |
This error can be caused by different linkage specifiers given in include files. | |
Change the extern statements so that the linkages agree. | |
The following is an example of this error:
extern void func( void ); // implicit C++ linkage extern "C" void func( void ); // error |
|
C2733 | second C linkage of overloaded function function not allowed |
More than one overloaded function was declared with C linkage. | |
When using C linkage, only one form of a given function can be made external. | |
Since overloaded functions have the same undecorated name, they cannot be used with C programs. | |
C2734 | identifier : nonextern const object must be initialized |
The specified identifier was declared as const but was not initialized. | |
An identifier must be initialized when declared as const unless it is declared as extern. | |
The following is an example of this error:
const int j; // error extern const int i; // OK, declared as extern |
|
C2735 | keyword keyword is not permitted in formal parameter type specifier |
The specified keyword was illegal in its context. | |
The following is an example of this error:
void main() { int *myint; myint = new static int; // error myint = new typedef int; // error myint = new auto int; // error myint = new register int; // error } |
|
C2736 | keyword keyword is not permitted in cast |
The specified keyword was illegally used in a cast. | |
The following is an example of this error:
int main() { return (virtual) 0; // error } |
|
C2737 | class1 : base class class2 must be exported |
A derived class class1 was exported, but its base class class2 was not. | |
If class1 is exported, class2 must also be exported. | |
C2800 | operator operator cannot be overloaded |
The specified operator was overloaded. | |
The following operators cannot be overloaded: class member access operator (.), pointer to member operator (.*), scope resolution operator (::), conditional expression operator (?:), and sizeof operator. | |
The following is an example of this error:
class C { operator:: (); // error :: is overloaded }; |
|
C2801 | operator symbol must be a nonstatic member |
The specified overloaded operator was not a member of a class, structure, or union, and/or was declared as static. | |
The following operators can only be overloaded in class scope as nonstatic members: assignment operator '=', class member access operator '–>', subscripting operator '[]', and function call operator '()'. | |
The following is an example of this error:
operator[](); // error, not a member class A { static operator->(); // error, static operator()(); // OK }; |
|
C2802 | static member operator symbol has no formal parameters |
The specified static member operator had a void formal parameter list. | |
An operator declared by a static member function must take at least one parameter. | |
The following is an example of this error:
class A { static operator+ (); // error, void parameter list static operator* ( A& ); // OK }; |
|
C2803 | operator symbol must have at least one formal parameter of class type |
The specified overloaded operator was declared without at least one class-type parameter. | |
The following is an example of this error:
int operator+( int, int ); // error |
|
C2804 | binary operator symbol has too many formal parameters |
The specified overloaded binary operator was declared with more than one parameter. | |
The following is an example of this error:
class X { X operator+ ( X , X ); // error, two parameters X operator+ ( X ); // OK, one parameter }; |
|
C2805 | binary operator symbol has too few formal parameters |
The specified binary operator was called with a void parameter list. | |
The following is an example of this error:
class X { public: X operator< ( void ); // error, must take one parameter X operator< ( X ); // OK }; |
|
C2806 | operator symbol has too many formal parameters |
The specified overloaded operator was declared with too many parameters. | |
The following is an example of this error:
class X { public: X operator++ ( int, int ); // error, more than 1 parameter X operator++ ( int ); // OK } ; |
|
C2807 | second formal parameter to postfix operator symbol must be int |
The second parameter to the specified postfix operator must be declared to be of type int. | |
The following is an example of this error:
class X { public: X operator++ ( X ); // error, nonvoid parameter X operator++ ( int ); // OK, int parameter } ; |
|
C2808 | unary operator symbol has too many formal parameters |
The specified overloaded unary operator was incorrectly declared with a nonvoid parameter list. | |
The following is an example of this error:
class X { public: X operator! ( X ); // error, nonvoid parameter list X operator! ( void ); // OK }; |
|
C2809 | operator symbol has no formal parameters |
The specified operator was incorrectly declared with a void parameter list. | |
The following is an example of this error:
int operator+ (); // error |
|
C2810 | second formal parameter for operator delete must be unsigned int |
An overloaded two-parameter operator delete must have its second formal parameter declared as an unsigned integer. | |
The second formal parameter in this form of the operator delete specifies the size of the object being deleted, and therefore it must be of type size_t, that is, an unsigned integer. | |
C2811 | too many formal parameters for based form of operator delete |
There were too many formal parameters for the operator delete for based pointers. | |
When used on based pointers, the operator delete takes either two or three actual parameters. | |
The following are the prototypes for the based form of the operator delete:
void operator delete ( __segment, void __based( void ) * ); void operator delete ( __segment, void __based( void ) *, \ unsigned int ); |
|
C2812 | second formal parameter required for based form of operator delete |
There were too few formal parameters for the operator delete for based pointers. | |
The following are the prototypes for the based forms of the operator delete:
void operator delete ( __segment, void __based( void ) * ); void operator delete ( __segment, void __based( void ) *, \ unsigned int ); |
|
C2813 | too many formal parameters for nonbased operator delete |
Too many formal parameters were provided for the nonbased form of the operator delete. The operator delete can take one or two formal parameters. | |
The following are the prototypes for the nonbased forms of the operator delete:
void operator delete ( void __near * ); void operator delete ( void __near *, unsigned int ); void operator delete ( void __far * ); void operator delete ( void __far *, unsigned int ); void operator delete ( void __huge * ); void operator delete ( void __huge *, unsigned int ); |
|
C2814 | second formal parameter for based form of operator delete must be __based(void) * |
The second formal parameter for an overridden based form of the operator delete must be of type __based(void) *. | |
The following are the prototypes for the based forms of the operator delete:
void operator delete ( __segment, void __based( void ) * ); void operator delete ( __segment, void __based( void ) *, \ unsigned int); |
|
C2815 | first actual parameter for based form of operator delete must be __segment |
The first formal parameter for an overridden based operator delete must be of type __segment. | |
The following are the prototypes for the based forms of the operator delete:
void operator delete ( __segment, void __based( void ) * ); void operator delete ( __segment, void __based( void ) *, \ unsigned int); |
|
C2816 | alternative form of operator delete must be a member |
The two-parameter form of the operator delete can be redefined only within a class, structure, or union. Global redefinitions of operator delete are allowed to have only one parameter. | |
C2817 | return type for operator delete must be void |
A redefinition of the operator delete contained a return statement that returned a type other than void. The return value for the operator delete must be void. | |
C2818 | incorrect return type for operator '–>' |
A redefinition of the class member access operator (–>) contained a return statement that did not return an appropriate type. | |
The class member access operator (–>) must return one of the following:
A pointer to a class, structure, or union A reference to a class, structure, or union where the –> operator is defined An instance of a class, structure, or union where the –> operator is defined |
|
C2819 | recursive return type for operator '–>' |
A redefinition of the class member access operator (–>) contained a return statement that was recursive. | |
To use recursion in a redefinition of the class member access operator, move the recursive routine to a separate function that is called from the operator override function. | |
C2820 | second formal parameter required for based form of operator new |
There were too few formal parameters for the operator new for based pointers. | |
This is the prototype for the based form of the operator new:
void __based( void ) * operator new ( __segment, unsigned int ); |
|
C2821 | first formal parameter for operator new must be unsigned int |
The first formal parameter of the near or far forms of the operator new must be an unsigned int. | |
The following are the prototypes for the near and far forms of the operator new:
void __near * operator new ( unsigned int ); void __far * operator new ( unsigned int ); |
|
C2822 | second formal parameter for huge form of operator new must be unsigned int |
The second formal parameter of the huge form of the operator new must be an unsigned int. | |
This is the prototype for the huge form of the operator new:
void __huge * operator new ( unsigned long, unsigned int ); |
|
C2823 | return type for based form of operator new must be __based( void ) * |
A redefinition of the based form of the operator new contained a return statement that returned a type that was not a based pointer. The return value for the operator new must be void __based( void ) *. | |
C2824 | return type for operator new must be void * |
A redefinition of the nonbased form of the operator new contained a return statement that returned a type that was not a void pointer. The return value for the operator new must be void. | |
C2825 | first formal parameter for huge form of operator new must be unsigned long |
The first formal parameter of the huge form of the operator new must be an unsigned long. | |
This is the prototype for the huge form of the operator new:
void __huge * operator new ( unsigned long, unsigned int ); |
|
C2826 | second formal parameter required for huge form of operator new |
There were too few formal parameters for the operator new for huge objects. | |
This is the prototype for the huge form of the operator new:
void __huge * operator new ( unsigned long, unsigned int ); |
|
C2827 | operator symbol cannot be globally overridden with unary form |
The given operator cannot have a unary form outside of an object. | |
Make sure that the overloaded operator is local to the object or choose an appropriate unary operator to overload. | |
C2828 | operator symbol cannot be globally overridden with binary form |
The given operator cannot have a binary form outside of an object. | |
Make sure that the overloaded operator is local to the object or choose an appropriate binary operator to overload. | |
C2829 | operator symbol cannot have a variable parameter list |
The given operator cannot have a variable parameter list. | |
Only the new and parentheses operators can take variable parameters. | |
C2830 | only placement parameters to operator new can have default values |
The standard formal parameters for the operator new cannot be given default values. Only user-defined placement parameters can specify defaults. | |
Since the compiler automatically passes values to the standard formal parameters, a default value is meaningless. | |
C2831 | operator symbol cannot have default parameters |
Default parameters cannot be specified for the given operator. | |
Only the new, assignment (=), and left parenthesis operators can have default values. | |
C2833 | operator symbol is not a recognized operator or type |
The operator command was not followed by either an operator (to override) or a type (to convert). | |
Make sure that the operator command is followed by an operator or a type. | |
C2834 | operator symbol must be globally qualified |
The given operator cannot be local to a class. Since the new and delete operators are tied to the class in which they reside, the scope resolution operator (::) cannot be used to select a version of the operator from a different class. | |
To implement multiple forms of the new or delete operator, create a version of the operator that takes extra formal parameters. | |
C2835 | user-defined conversion type takes no formal parameters |
A user-defined type conversion was declared as having one or more formal parameters. User-defined type conversions cannot take formal parameters. | |
Remove the formal parameters or choose an operator to overload. | |
C2836 | cannot export identifier; a previous declaration did not export it |
The given identifier was declared to be exported, but a previous declaration did not export it. | |
All declarations of a given identifier must be either external or nonexternal. | |
The following is an example of this error:
extern int i; // i not exported int __export i; // error, i exported |
|
C2837 | identifier : illegal local static variable in exported inline function |
There was an attempt to declare a local static variable inside an external inline function. External inline functions cannot declare local static variables. | |
C2850 | #pragma hdrstop cannot be nested in a function or definition |
The hdrstop pragma cannot be placed inside the body of a function or definition. | |
Move the #pragma hdrstop statement to an area that is not contained in curly braces or parentheses. | |
C2851 | #pragma hdrstop required for /Yu command-line option without filename |
The /Yu (use precompiled headers) command-line option did not specify the name of a precompiled header file, and there was no #pragma hdrstop statement. | |
This error can be avoided by specifying a filename after the /Yu command-line option or by using #pragma hdrstop in the source file. | |
C2852 | filename is not a valid precompiled header file |
The given filename is not a precompiled header file. | |
Make sure that all /Yu command-line option and #pragma hdrstop statements specify valid precompiled header files. The compiler assumes the .PCH extension if none is provided. | |
This error is caused by giving the filename of a file that is not a precompiled header, such as an .HPP file. | |
C2853 | filename is not a precompiled header file created with this compiler |
The given precompiled header is not compatible with this version of the compiler. | |
Recompile the program or the header with the same version of the compiler. | |
This error can be caused by mixing 16-bit and 32-bit source files and precompiled headers. | |
C2854 | syntax error in #pragma hdrstop |
The #pragma hdrstop statement gave an invalid filename. | |
The hdrstop pragma is followed by an optional filename enclosed in parentheses and quotation marks, as in:
#pragma hdrstop( "source\pchfiles\myheader.pch" ) |
|
The precompiled header filename cannot be enclosed in angle brackets (<>). |