You passed an illegal option to cpp through cc or you used an illegal option on the cpp command line. In compatibility mode, cpp issues a warning. In ANSI mode, cpp issues an error.
Remove the illegal option. See man page for legal options.
Mode: ANSI C
The -H option used on the preprocessor command line contains an invalid number such as zero.
Change the invalid buffersize to a non-zero valid value, for example, -H46000. The default is 8188.
Mode: Compatibility and ANSI C
In your source, the #undef directive undefined one of the key words: defined, <esc|LINE, FILE, DATE, TIME, STDC|.
Delete this #undef directive.
Mode: ANSI C
Found an #undef directive that contains extra characters at end of the undef directive (maybe you used one #undef directive to undefine more than one identifier.)
Delete the extra characters.
Mode: ANSI C
In your source, the #define directive defined one of the key words: defined, <esc|LINE, FILE, DATE, TIME, STDC|.
Delete this #define directive.
Mode: ANSI C
You may have an unterminated string or character constant in the replacement list of a macro definition, for example,
#define FOO 'a or #define FOO "ab.
Add the closing delimiter to the replacement list.
Mode: ANSI C
The replacement string of a macro definition began with a ## operator, for example, #define FOO ## foo.
Delete the ## operator or add a preprocessing token before the ## operator.
Mode: ANSI C
The replacement string of a macro definition ended with a ## operator, for example, #define FOO foo ##.
Delete the ## operator or add an preprocessing token after the ## operator.
Mode: ANSI C
A function-like macro defined in the source has a # operator. But the # operator is not followed by a parameter.
Delete # or add a parameter after #.
Mode: ANSI C
A function-like macro definition contains duplicate argument names, for example, #define FOO(a,a).
Change the duplicate argument name.
Mode: ANSI C
The argument of the -U option you passed to the cpp has an illegal leading character.
Change the leading character of the argument to a legal character, for example, an upper case or lower case letter or an underscore.
Mode: ANSI C
The replacement string of a macro definition probably contains an illegal comment.
Delete the offending comment.
Mode: ANSI C and Compatibility
During macro substitution, an illegal comment was found.
Change the macro strings.
Mode: ANSI C and Compatibility
You may have defined a function-like macro with a very long parameter that does not fit into the parameter buffer. The default size of the parameter buffer is 8188 bytes.
Increase the size of the parameter buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
During the function-like macro invocation, cpp can't find the close parenthesis, for example, FOO(a,b
Add the close parenthesis to the macro.
Mode: ANSI C and Compatibility
The expanded macro may be too long to fit into the macro buffer. The default size of the macro buffer is 8188 bytes.
Increase the size of the macro buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
You may have defined a function-like macro. And during the argument substitution of that macro, the expanded argument is too long to fit into the argument buffer. The default size of the buffer is 8188 bytes.
Increase the size of the argument buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
You may have defined a function-like macro with the # operator in the replacement string. And the # operator produces a very long literal string which does not fit into the argument buffer. The default size of the buffer is 8188 bytes.
Increase the size of the argument buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
After all parameters in the replacement list have been substituted, the resulting preprocessing token sequence is rescanned. But this resulting preprocessing token sequence is too long to fit into the argument buffer. The default size of the buffer is 8188 bytes.
Increase the size of the argument buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
You may have included a header file which has too many symbolic links or other reasons. See stat(2) in man page for other possibilities of the failure.
Reduce the number of symbolic links or take appropriate action for other causes.
Mode: ANSI C and Compatibility
Found extraneous characters on the #ifdef directive.
Remove the extraneous characters. Note that in compatibility mode, the preprocessor issues a warning (see warning message number 2008).
Mode: ANSI C
Found extraneous characters on the #ifndef directive.
Remove the extraneous characters.
Mode: ANSI C
Found two consecutive #else directives.
Delete the extra #else directive.
Mode: ANSI C and Compatibility
Found the #elif directive without the matching #if or #ifdef directives.
Add the missing #if or #ifdef or #ifndef.
Mode: ANSI C and Compatibility
Found the #else directive without the matching #if or #ifdef directives.
Add the missing #if or #ifdef or #ifndef.
Mode: ANSI C and Compatibility
Found the #endif directive without the matching #if or #ifdef directives.
Add the missing #if or #ifdef or #ifndef.
Mode: ANSI C and Compatibility
The depth of the nested #if or #ifdef or #ifndef directives exceeds 100.
Change the depth to 99 or less.
Mode: ANSI C and Compatibility
You used an illegal macro name in the defined operator. Maybe the leading character of the macro name is not a legal character, that is, not an upper case or lower case letter or an underscore.
Use a legal macro name.
Mode: ANSI C and Compatibility
You omitted the right parenthesis ")" of the defined operator.
Add the right parenthesis.
Mode: ANSI C and Compatibility
Found #if or #ifdef or #ifndef without the matching #endif.
Add the missing #endif. Note that in compatibility mode, the preprocessor issues a warning (see warning message number 2011).
Mode: ANSI C
The file name of the header may be illegal or the header is followed by extraneous characters.
Use a legal filename or remove the extraneous characters.
Mode: ANSI C and Compatibility
The depth of the nesting include files is equal to or greater than 50. You may have included a header file which includes itself.
Reduce the nesting depth.
Mode: ANSI C and Compatibility
Unable to find the include file in the directories of the search path list or the include file does not exist.
Use the -I option to get the include file or create the include file.
Mode: ANSI C and Compatibility
You may have extraneous characters in the #line directive, for example, #line 100 extra stuff. Note that if the extraneous characters are double-quoted then they are accepted as a file name.
Remove the extraneous characters.
Mode: ANSI C and Compatibility
You may have used bad syntax in the constant expression of the #if directive.
Correct the syntax.
Mode: ANSI C and Compatibility
Found an empty character literal in the #if directive, for example, #if .
Use a non-empty character literal.
Mode: ANSI C and Compatibility
The value of the octal character constant in the #if directive is greater than 255, for example, #if '\777'.
Change the octal character constant to a valid value.
Mode: ANSI C and Compatibility
The hexadecimal constant or hexadecimal character constant in the #if directive has no digits, for example, #if '\x' or #if 0x.
Add digits in the hexadecimal constant.
Mode: ANSI C and Compatibility
The right quote on the character constant in the #if directive is missing, for example, #if '\7.
Add the right quote to the character constant.
Mode: ANSI C and Compatibility
Found the illegal character = in #if directive.
Remove = character or change = to ==.
Mode: ANSI C and Compatibility
The value of the hexadecimal constant in the #if directive is greater than 0xFFFFFFFF, for example, #if 0x100000000.
Change the hexadecimal constant to a valid value.
Mode: ANSI C and Compatibility
Found an illegal character in #if directive.
Delete the illegal character.
Mode: ANSI C and Compatibility
An input line (terminated by a new-line character) is too long to fit into the input buffer. The default size of the buffer is 8188 bytes.
Increase the size of the input buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
Found the non-terminating comment at end of file.
Add the comment close delimiter (i.e. */).
Mode: Compatibility
Found the non-terminating comment at end of file.
Add the comment close delimiter (i.e. */).
Mode: ANSI C
A backslash character is followed by a continuation character on the last line of file.
Delete the last line.
Mode: ANSI C and Compatibility
A continuation character was found on the last line of file.
Remove the continuation character.
Mode: ANSI C and Compatibility
Multiple physical source lines (with new-line characters and immediately preceding backslash characters) have been spliced to form a logical source line. And this logical source line is too long to fit into the logical line buffer. The default size of the buffer is 8188 bytes.
Increase the size of the buffer by using the cpp -H option.
Mode: ANSI C and Compatibility
The preprocessor found a unknown preprocessing directive.
Make sure you spell the preprocessing directive correctly.
Mode: ANSI C and Compatibility
A macro name on #undef directive is missing or an illegal macro name on #define directive was found.
Add a macro name on #undef or have a valid macro name on #define.
Mode: ANSI C and Compatibility
You defined a function-like macro with invalid parameters. The leading character of the parameter name probably is not a legal character, that is, not an upper case or lower case letter or an underscore. Or, you defined a function-like macro that has a missing formal parameter. For example, #define foo(a,,b).
Make sure you spell the parameter names correctly. Or delete the extra comma.
Mode: ANSI C and Compatibility
You defined a function-like macro with too many macro parameters. The maximum number of macro parameters is 126.
Reduce the number of macro parameters to 126 or less.
Mode: ANSI C and Compatibility
The error message is generated by the #error directive.
This message is generated per your request.
Mode: ANSI C
You did not include error message text on the #error directive line.
Add error message text to #error directive line.
Mode: ANSI C and Compatibility
You included a comma operator in the constant-expression on the #if directive, for example, #if a,b.
Remove the comma operator.
Mode: ANSI C
You incorrectly specified the -t compiler option.
Correct the usage of this option.
The cc command could not launch a subprocess because there are too many other processes already running on the system.
Wait until the system is less busy. You may also want to consider reconfiguring your system to allow more concurrent processes.
The cc command could not launch a subprocess because the associated file does not exist, or does not have execute permission.
Check the file permissions for execute access.
The subprocess terminated because of an internal error or because it was killed.
If a core file exists, there was probably an internal error. Report this error to your HP support personnel.
The argument specified after the -o option either has the suffix .c or begins with a + or -. None of these is a valid name for the output file.
Check the command line; the file name is probably missing.
When the .c file shares an inode with the .o file (using a link, for example), then writing to the .o file will overwrite the .c file.
Use the -o option to specify an alternate name for the object file, or create separate .o and .c files.
You invoked the compiler with a standard level other than a or c.
Recompile using a proper standard level with the -A option.
The type of an array is function. For example,
char g(void) { return('a'); }
main()
{
char f[4]();
f[0] = g;
printf("%c\n",f[0]());
}
Use type pointer to function. For example,
char g(void) { return 'a'; }
main()
{
char (*f[4])();
f[0] = &&g;
printf("%c\n",f[0]());
}
Mode: ANSI 3.1.2.5
Only the first dimension of an array declaration can use empty brackets ([ ]). For example,
int arr[ ][ ][4], brr[4][3][ ];are incorrect declarations.
Specify the size of each subsequent dimension of the array after the first element. In the example above, specify
int arr[ ][2][4], brr[4][3][1];Mode: ANSI 3.1.2.5
The expression specifying the size of an array is not a constant. For example,
int i = 4; char arr[i];Only use expressions that evaluate to a constant value at compile time. For example, use the statements
char arr[4];or
char arr[2+2];Mode: ANSI 3.5.4.2
The expression specifying the size of an array is not an integral constant expression. For example, although 4*2/1.6 evaluates to 5, the value is converted to type float (5.000) because of the value 1.6.
However, the declaration
int arr[4*2/3];is acceptable because the expression specifying the size is an integral constant expression.
Use a cast or change the expression so it evaluates to an integer value. For example,
int arr[(int) (4 * 2/1.6)];or
int arr[4*20/16];Mode: ANSI 3.5.4.2
The expression specifying the size of an array evaluates to a number that is not greater than zero. For example,
int arr[2*4/-3-5]; /* evaluates to int arr[-7]; */Because declaring an array of negative dimension has no meaning, check the expression and change the declaration to evaluate to a positive number. For example, the above declaration might have been intended to be
int arr[2*4/-(3-5)];which evaluates to
int arr[4];Mode: ANSI 3.5.4.2
The return type of a function is declared to be function or array. For example,
main()
{
char f()[4]; /* function returning array */
char g()(); /* function returning function */
}
The function should be declared as returning pointers to the appropriate
type. For example,
main()
{
typedef Arr[4];
typedef Func();
Arr *f(); /* returns a pointer to array */
Func *h(); /* returns a pointer to a function */
}
Mode: ANSI 3.5.4.3
A function declarator that is not part of a function definition has an identifier list that is not empty. For example, func(a,b);.
You might have inadvertently put a semicolon after a function declarator. If not, remove the identifier list from the external declaration.
Mode: ANSI 3.5.4.3
The program attempts to declare a register global. For example,
register int var;
main() { }
The register class is used in an external declaration.
Remove the register class specifier from the declaration.
Mode: ANSI 3.7
Your program uses an illegal combination of types. For example,
long short i; unsigned void x;See the Chapter 3 for all variations of proper type combinations. An example of a valid declaration is
unsigned short us;Mode: ANSI 3.5.2
Your program assigns a nonconstant to an enumeration constant. In the following example, blue = i is flagged as an error.
main()
{
int i = 44;
enum colors { red = 4, green, blue = i, yellow};
}
Only assign constant values to enumeration constants. The enumerator above
should have been blue = 44.
Mode: ANSI 3.5.2.2
The expression defining the value of an enumeration constant is not an integral constant expression. For example,
main()
{
enum colors { red = 4, blue = 5.65, yellow = red,
green = 'a'};
}
Only assign integral constant expressions to enumeration constants. In
the example, these enumerators are legal:
red = 4 yellow = red green = 'a'However, the initializer
blue = 5.65is not legal. It could be changed to
blue = 5or
blue = 6or
blue=(int) 5.65Mode: ANSI 3.5.2.2
Your program gives a bit-field within a structure a nonconstant size. In the following example
main()
{
int i = 15;
struct S {
char c;
int bf : 2 * 3;
int df : i;
} st;
}
the struct-declarator
int bf : 2 * 3;is acceptable, but
int df : i;is not.
Use an integral constant expression to specify the size of a bit-field. Change the struct-declarator above to
int df : 15;
Mode: ANSI 3.5.2.1
The type of a bit-field is not integral. For example,
struct S {
float af : 5;
int pf[3] : 29;
int *ptr : 13;
} st;
Use an integral type for the type of a bit-field, such as int, char,
or enum tag. Do not use floats, pointers, or arrays. If
you want to conform to ANSI C, the only allowable bit-field types are int,
unsigned
int, and signed int.
Mode: ANSI 3.5.2.1
Your program specified a bit-field size that is greater than the size of an int (32 bits) or less than zero. For example,
struct S {
int af : 32; /* acceptable */
int bf : -2; /* not acceptable */
} st;
Use a constant integer field size that is not less than zero and not greater
than the bit size of the declared type.
Mode: ANSI 3.5.2.1
You attempted to initialize an illegal type with a string initializer. For example:
struct SS { int i; } s = {"abc"};
Check that the member type is correct. For example:
struct SS { char *c; } s = {"abc"};
Mode: ANSI 3.5.7
The string used to initialize an array of character type contains more characters than specified by the size of the array. (Remember that the terminating null character will not be appended to the array unless there is enough room for it.) For example,
char Str[4] = "12345";Increase the size of the array, such as
char Str[5] = "12345";Alternatively, decrease the size of the string initializer, such as
char Str[4] = "1234";Or, let the compiler calculate the size needed for the array:
char Str[] = "12345";In this case, a terminating null character will be appended to the array; so, its size will be 6.
Mode: ANSI 3.5.7
Your program attempts to initialize a typedef name as if it were a variable. For example,
typedef char * String = "hi there";Do not use initialization in a typedef declaration. Because a typedef declaration does not declare an object, you may not initialize it; the typedef name is a synonym for a type. The example might be corrected as follows:
typedef char * String; String Str_var1 = "hi there";Mode: ANSI 3.5.7
Your program attempts to initialize an imported variable that is declared extern, and whose proper definition appears elsewhere. For example,
int global;
main()
{
int i = 10;
if (i 0){
extern int global = 1;
} i = 0;
}
Only initialize a variable when it is defined. For example,
int global = 1;
main()
{
int i = 10;
if (i 0) {
extern int global;
i = 0;
}
}
You have initialized a function, such as static int func() = 3;.
Remove the initialization from the function declaration.
Mode: ANSI 3.5.7
An initializer for an object with static storage duration is not a valid constant. Such a constant must be an arithmetic constant expression, a null pointer constant, an address constant, or an address constant plus or minus an integral constant expression. For example,
char *s = "hi there";
char * title = s; /* not constant */
main() { }
Either initialize the variable to a valid constant or at run-time, initialize
the variable to another variable that has been initialized. For example,
char * title = "hi there";or
char *s = "hi there";
char * title;
main()
{
title = s;
}
Mode: ANSI 3.5.7
Your program initializes a pointer to a noninteger. For example,
int *p = 'a';Pointers can only be initialized to constant integer expressions or to an address plus or minus an integer constant. For example,
int i, * ptr = 46; char * name = "The Title"; int *p = <esc|&i|;Mode: ANSI 3.5.7
An initializer list contains more initializers than elements in the object being initialized.
int arr[3] = {0, 1, 2, 3};
main()
{
static struct {int i; char c;} s = {4,'e',55};
}
Either increase the size of the object being initialized or decrease the
number of initializers. For example,
int arr[4] = {0, 1, 2, 3};
or
int arr[3] = {0, 1, 2};
and
static struct {int i; char c; int j;} s = {4,'e',55};
or
static struct {int i; char c;} s = {4,'e'};
Mode: ANSI 3.5.7
The initializer contains more levels of nested braces than is allowed. For example,
int i = <esc|3;|Remove unnecessary braces.
Mode: ANSI 3.5.7
A switch statement contains more than one default label. For example,
switch (c) {
default: fprintf(stderr, "not an option.\n");
break;
case 'f': do_f(); break;
default: fprintf(stderr, "error\n"); break;
}
Remove one of the default labels.
Mode: ANSI 3.6.4.2
Two case expressions in the same switch statement have the same value. For example,
switch (c) {
case 'f':
case 'g': do_f_or_g(); break;
case 'f': do_f(); break;
default: fprintf(stderr, "not an option. \n");
break;
}
Remove one of the case labels with the duplicate value.
Mode: ANSI 3.6.4.2
Your cast expression attempted an illegal conversion. For example:
struct SS {int i; char j;} * s_ptr;
union UU {int a; char b;} u, *u_ptr = &&u;
s_ptr = (struct SS) u_ptr;
Either cast to void type, or make sure the type name specifies scalar type
and the operand has scalar type. For example:
st_ptr = (struct S *) un_ptrMode: ANSI 3.3.4
In a subscript expression, one of the expressions must have pointer type and the other must have integral type. For example:
arr[4.54] = 4;Make sure that one of the expressions (typically the one outside of the brackets) is a pointer and the other expression has integral type.
Mode: ANSI 3.3.2.1
The left operand of a . operator is not a struct or union. For example,
int st; st.i = 4;Change the left operand to have structure or union type. For example:
struct S {int i; char c;} st;
st.i = 4;
Mode: ANSI 3.3.2.3
Your program uses an undefined variable as the left operand of a . operator. For example:
main()
{
struct S *stp;
(*stp).i = 4;
st.i = 4; /* st undefined because struct S
hasn't been specified */
}
Define the variable to be a struct or union. Make sure you are using the
correct variable of the left side of the . operator. For example,
struct S { int i; char c; } st;
st.i = 4;
Mode: ANSI 3.3.2.3
The second operand of a . operator or a - operator does not name a member of the corresponding structure or union. For example,
main()
{
struct { int i; char c; } st, *p = <esc|&st|;
p-z = 4;
st.d = 'a';
}
First verify that the left side is the correct structure or union variable.
If it is, change the member (right side) to be the correct member (one
that was defined within the given struct or union). For the example above,
p-i = 4; st.c = 'a';Mode: ANSI 3.3.2.3
The left operand of a reference operator (-) is not a pointer. For example,
main()
{
int *q;
struct S { int i; char c; } s, *p=<esc|&s|;
s-i = 4;
}
First verify that the left side is the correct struct or union pointer
variable. Either use
s.i = 4;or
p-i = 4;Mode: ANSI 3.3.2.3
Your program does not call a function correctly. For example,
void f (int y, int z);
void g (enum a {A,B} x);
main()
{
int i = 10;
(* (i ? F: g)) ();
}
Call a function by checking if the function is being called directly or
indirectly through a pointer to the function.
The program attempts to use a function pointer in an arithmetic expression. For example:
int (*fp)();
int f(){};
main()
{ int i,j;
fp = f;
j = 3;
i = j + fp; /* this is illegal */
}
It is illegal to use a function pointer in a context where an arithmetic
type is required.
If this is really what you want, cast the function pointer to an integer.
i = j + (int) fp;
Mode: ANSI 3.3
Your program uses nonintegral operands with a bitwise operator. Examples of nonintegral expressions are pointers, floats, functions, arrays, structs, and unions. Bitwise operators are: |, ^, and &. For example,
float f; int i; i = f^i; /* incorrect usage because f is a float */ i &= f; /* incorrect usage because f is a float */Check your program for the following:
The expression used for initializing a variable is too complex to be determined at link time. Usually this is due to using an expression involving an address minus an address or an address plus an address. For example:
int i = 0,j = 0;
int a = (int) <esc|&i - (int) &j|;
main()
{
}
Initialize (assign) the variable dynamically. For example:
int i = 0,j = 0;
int a;
main()
{
a = <esc|(int) &i - (int) &j|;
}
Mode: ANSI 3.4
You have not followed the rules for the operand types in a relational expression or an equality expression.
Make sure you are comparing the correct objects. You could have used an array name instead of an element in an array, or you could have used a struct or union name without accessing a member. Either compare the correct objects or cast the operand to the appropriate type.
Mode: ANSI 3.3.8, 3.3.9
The operands to a shift operator ( or ) are not of integral type. For example,
int *p, *q, i = 4; q = p i;Make sure you want to shift the indicated operand. If you do, cast the operand to an int type.
q = (int*) ((int) pi);Mode: ANSI 3.3.7
A pointer was declared without fully defining the object it points to; such a pointer cannot be manipulated arithmetically because the size of the object is unknown. For example,
struct s *p;
main()
{ p++; }
This error may also be caused when a header file is not included.
Fully declare the type of the object pointed to. For example,
struct s {
int a,b,c;
} *p;
main()
{ p++; }
Be sure that all necessary header files have been included.
Mode: ANSI 3.3.6
One operand to an addition operator is a pointer, but the other does not have integral type. For example,
int *p, *q; p = p + q; p += q;Make sure that this is what you want to do. If it is, cast the other operand to int. For example,
p = p + (int)q; p = (int)p + p; p += (int)q;Mode: ANSI 3.3.6
The first operand of a subtraction operator has integral type and the second operand is a pointer. For example,
int i, *q; i = i - q; i -= q;Make sure that this is what you want to do. If it is, cast the pointer to int. For example,
i = i - (int)q; i -= (int)q;Mode: ANSI 3.3.6
va_alist can now be in a list with other parameters, but it must be at the end.
Your program uses a nonarithmetic type with one of the following operators: +, -, *, /, or %. Arithmetic types include floating types, integer types, character types, and enumerated types. For example,
int *ptr, e; e = ptr * 2;Make sure that this is what you want to do. You could have used an array name instead of an element of an array, or you could have used a struct union name without accessing a member. If you do want to perform the operation on a pointer, cast it to int:
e = (int)ptr *2;
Mode: ANSI 3.3
The operands to a modulus operator (%) do not both have integral type. For example,
double d = 66.666; int i = 5; i = d % i; i %= d;Cast the noninteger operand or operands to int. For example,
i = (int)d % i; i %= (int)d;Mode: ANSI 3.3.5
Your program uses nonscalar operands with a logical operator. Scalar types include arithmetic types and pointer types. Examples of nonscalar types are structs and unions. Logical operators are: <esc|&&| and ||.
Check whether a struct or union name was used without specifying a member.
Mode: ANSI 3.3.13, 3.3.14
Your program initializes an object with static storage duration, using an illegal initialization expression, such as with a function call:
int i = zero();Only use constant expressions to initialize objects with static storage duration. For example,
int i = 0;Mode: ANSI 3.5.7
Your program does not use an lvalue on the left side of the assignment operator. Some non-lvalues are array names without the subscript, function names, and enumeration constants. For example,
enum color {red, green, blue};
int i=4, *p, arr[4];
int func();
green = red; /* green is a constant */
arr = p; /* arr is an array */
f() = i; /* f is a function name */
<esc|&i| = p; /* <esc|&i| cannot be assigned to */
Do not use a non-lvalue on the left side of an assignment. Enum constants,
functions, and other expressions produce a value that can never be assigned
to. Array elements can be assigned to but arrays as a whole cannot. However,
an array may be declared inside a struct, and that struct may be assigned
to:
struct {
int arr[10];
} a,b;
a = b;
Mode: ANSI 3.3.16
The first operand of a conditional expression does not have scalar type. For example,
struct SS { int i,j; }s;
s.i = (s.j 906)?s:2;
Check the expression; you might have left off a member reference, an array
subscript, or a pointer indirection. For example,
s.i = (s.j 906) ? s.j : 2;Mode: ANSI 3.3.15
This error occurs when the second and third operands in the conditional expression have mismatched types, or one is a pointer and the other is a nonzero integer. For example,
i = i ? i : ptr;If you want to use expressions of different types, cast them to the same type if it is reasonable to do so. Both result expressions can be arithmetic, pointers of the same type, identical types, or one can be a pointer and the other a constant integer expression with value zero (for null pointer). For example,
i = i ? i : (int)ptr;Mode: ANSI 3.3.15
The indirection operator (*) is being applied to a nonpointer. For example,
int i, p; i = *p;Make sure that this is what you want to do. If it is, cast the operand to a pointer of the appropriate type. Otherwise, change the type to a pointer. For example,
i = *(int *)p;or
int i, *p; i = *p;Mode: ANSI 3.3.3.2
The operand of the unary <esc|&| operator must be a function designator or an lvalue.
enum {red, blue, green};
int *p;
p = <esc|&4|;
p = <esc|&red|; /* where red is a constant. */
If you want a pointer to a variable with the value, use a temporary variable,
such as,
i = 4; p = <esc|&i|; color = red; p = <esc|&color|;Mode: ANSI 3.3.3.2
The address-of operator (&) is being applied to a register variable. For example,
register index; int *p; p = <esc|&index|;Remove the register storage class specifier from the variable declaration. For example,
int index;Mode: ANSI 3.3.3.2
The operand to a unary minus operator (-) does not have arithmetic type. For example,
double *ptr; -ptr;Check the operand. You may have left off a member reference, an array subscript, or a pointer indirection. For example,
-(*ptr);Mode: ANSI 3.3.3.3
The operand to a not operator (!) does not have scalar type. For example,
struct SS { int arr[10]; int j; } s;
if ( !s );
Check the operand. You might have left a member reference off a struct
or union name. For example,
if ( !s.j );Mode: ANSI 3.3.3.3
The operand to a complement operator (~) does not have integral type. For example,
struct SS { int arr[10]; int j; } s;
int *p;
if (~s);
if (~p);
Check the operand. You might have left off a member reference on a struct
or union name or forgotten to dereference a pointer. For example,
if (~s.j); if (~*p);Mode: ANSI 3.3.3.3
Your program uses a non-lvalue with either pre-increment (<esc|++|var), post-increment (var<esc|++|), pre-decrement (--var), or post-decrement (var--) operators. Non-lvalues include constants, functions and other expressions that cannot be assigned to or modified. For example,
int i, *p, arr[3]; i = --4; p = arr++;Only use modifiable lvalues with the <esc|++| and -- operators. The above examples might have been intended to be
i = 3; p = arr + 1;Mode: ANSI 3.3.2.4, 3.3.3.1
Your program uses a nonscalar operand with the <esc|++| or -- operator. For example, this occurs when you try to use <esc|++| or -- with a struct or union name. For example,
int a;
struct { int i; char c; } st;
a = st--;
Check to see if you left off a member selection. Only use scalar operands
with <esc|++| and --. For example,
a = (st.i)--;Mode: ANSI 3.3.2.4, 3.3.3.1
The address-of operator (&) is being applied to a bit-field.
struct { unsigned i : 4; unsigned *j; } s;
s.j = <esc|&s.i|;
Do not take the address of a bit-field. You might want to use the contents
of the bit-field or take the address of another member of the structure.
For example,
s.j = s.i; s.j = (unsigned *)&&s.j;Mode: ANSI 3.3.3.2
The expression in an if statement does not have scalar type. For example,
struct { int i; char c; } s;
if ( s );
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
if (s.i);Mode: ANSI 3.6.4.1
The controlling expression in a while statement does not have scalar type. For example,
int x, y;
struct { int i; char c; } st;
while ((x == y) <esc|&&| st);
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
while ((x == y) <esc|&&| st.c);Mode: ANSI 3.6.5
The controlling expression in a do statement does not have scalar type. For example,
struct { int i; char c; } s;
do { ; } while (s);
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
do { ; } while (s.i);
Mode: ANSI 3.6.5
The controlling expression in a for statement does not have scalar type. For example,
char array[12];
for (array = 0; array<= 2.0; array++) { ; }
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
for (array[0] = 0; array[0] <= 2.0; array[0]++) { ; }
Mode: ANSI 3.6.5
The controlling expression in a switch statement does not have integral type. For example,
float f;
int arr[3];
switch(f) {
default: break;
}
switch(arr) {
default: break;
}
If you want to switch on the value of the nonintegral type, cast the expression
to int. Otherwise, change the expression to have integral type. For example,
switch((int)f) {
default: break;
}
switch(arr[1]) {
default: break;
}
Mode: ANSI 3.6.4.2
A case statement is not inside a switch statement. For example,
switch (x) {
case 1: {}
}
case 2: {}
Check your program's braces. Problems with braces occur when an extraneous
brace prematurely terminates a switch statement, leaving a dangling statement
outside. For example,
switch (x) {
case 1: {}
case 2: {}
}
Mode: ANSI 3.6.1
The expression of a case label is not a constant expression. For example,
int j=2, x, w=24;
switch ( j + 20 ) {
case 23: x = 1; break; /* ok */
case w: x = 5; break; /* not ok */
default: printf("default\n"); break;
}
Never use a variable or nonconstant expression in a case label.
Mode: ANSI 3.6.4.2
A default label is not inside a switch statement. For example,
switch (x) {
case 1: { }
case 2: { }
}
default: { }
Check your program's braces. Problems with braces occur when an extraneous
brace prematurely terminates a switch statement, leaving a dangling statement
outside. The program can be corrected to
switch (x) {
case 1: { }
case 2: { }
default: { }
}
Mode: ANSI 3.6.1
A break statement is not inside a loop body or switch body. For example,
switch (x) {
case 1: { }
case 2: { }
}
break;
Check your program's braces. Problems with braces occur when an extraneous
brace prematurely terminates a loop or switch statement, leaving a dangling
statement outside. The program can be corrected to
switch (x) {
case 1: { }
case 2: { }
break;
}
A continue statement is not inside a loop body. For example,
while (i < 20) {
}
continue;
Check your program's braces. Problems with braces occur when an extraneous
brace prematurely terminates a loop, leaving a dangling statement outside.
The program can be corrected to
while (i < 20) {
continue;
}
Mode: ANSI 3.6.6.2
This error is usually caused by attempting to define a variable to be an illegal type. In the example below, because an array of functions is not allowed, the type of f is undefined.
char f[4]();Use only legal types to define variables.
Mode: ANSI 3.1.2.5
Your program declares a variable to be a type of unknown size. In the following example, struct S has an incomplete type; it is of unknown size.
struct S st; st.i = 4;Check if you forgot to include a file where the type is defined and declare the variable to be a type with known size.
Mode: ANSI 3.1.2.5
Your program declares an external variable to be type void. For example,
extern void i;Only functions can be declared as type void, so declare the variable to be another type, such as int.
Mode: ANSI 3.1.2.5
Two members of a struct or union have the same name. For example,
struct SS {
int a;
int a;
} s;
Rename one of the members so they do not conflict. For example,
struct SS {
int a1;
int a2;
} s;
Mode: ANSI 3.5
The type of one of the members of a struct or union is a function. For example,
struct SS {
int a;
int func();
} s;
Check if you want a pointer to the function instead of the function. For
example,
struct SS {
int a;
int (*func)();
} s;
Mode: ANSI 3.5.2.1
The size of a member of a struct or union cannot be determined. This usually occurs when an array is declared to be a member and the dimensions are not specified. For example,
struct {
int i;
int arr[ ];
} st;
Verify that all members have specified sizes. Give sizes of arrays and
check that member structures and unions have names. For example,
struct {
int i;
int arr[10];
} s;
Mode: ANSI 3.5.2.1
A member of a union or structure has a size of zero. For example,
union {
struct {
int b : 0;
} s;
int i;
} un;
Verify that all members have specified nonzero sizes. Give sizes of arrays
and check that member structures and unions have names and have at least
one nonzero sized member. For example,
union {
struct {
int a : 16;
int : 0;
int c : 5;
} s;
int i;
} un;
Mode: ANSI 3.5.2.1
A declaration of name is in the declaration list of a function definition, but is not specified in the identifier list of the function declarator. For example,
func(a,b)
int a,b,c;
{}
Either include the missing parameter in the identifier list, or remove
it from the declaration list. For example,
func(a,b,c)
int a,b,c;
{}
or
func(a,b)
int a,b;
{}
Mode: ANSI 3.7.1
A bit-field in a structure has zero size. For example,
struct {
int a : 3;
int b : 0; /* ERROR: Zero-sized field. */
int c : 18;
} s1;
A zero-sized bit-field must not be named. An unnamed zero-sized bit-field
in a structure forces the next member of the structure to be word-aligned.
If this is what you want, remove the name on the field declaration, as
shown in example A below. If you do not want to force the next member of
the structure to be word aligned, remove the zero-sized bit-field member,
as shown in example B, or assign a size to the field, as shown in example
C.
Mode: ANSI 3.5.2.1
An identifier appears more than once in a function's parameter list.
For example,
Mode: ANSI 3.5
This error occurs when the types of a variable or function definition
and a variable or function declaration do not match. For example,
Mode: ANSI 3.1.2.6
This error occurs when a function has been defined more than once. For
example,
Mode: ANSI 3.7
A structure or union tag is redeclared with members. For example,
Mode: ANSI 3.5.2.3
Your program uses an identifier before it has been declared. For example,
An identifier is used as a function designator when it was not declared
as a function. For example,
This error is caused by using an identifier as if it were a type name
when it was never defined as a type. For example,
A label is declared more than once in a function. For example,
The operand of the sizeof operator is unknown to the compiler.
For example:
Mode: ANSI 3.3.3.4
A structure or union tag is redeclared with members. For example,
Mode: ANSI 3.5.2.3
Your program attempts to define a type to be a function definition or
attempts to define a function definition to be a type. For example,
Mode: ANSI 3.5
You attempted to initialize a long pointer.
If you really want a long pointer, make the assignment in a separate
statement. Otherwise, change the ^ to *.
Mode: ANSI Long pointers are an extension to ANSI C.
The type of an initializer for a function pointer is not integer, pointer,
or function. For example,
The type of an initializer is not compatible with the type of the object
it is initializing. For example,
An object with integral type is being initialized with a pointer. For
example,
A structure of unknown size is being initialized. For example, struct
y below has not been defined:
The types of the operands are illegal in combination with the indicated
operator. For example,
An argument to a function call has been cast to type void. Since the
cast to void effectively discards the value, you are actually passing nothing.
Remove the void cast.
Mode: ANSI 3.2.2.2
A function whose return type is void has a return statement
with an expression. For example,
The declaration for a structure field specifies more bits than the field
type will allow. For example:
Mode: ANSI 3.5.2.1, A.6.5.8
Your program defines a structure that fails to specify at least one
member with a nonzero size. For example:
Mode: ANSI 3.5.2.1
Your program defines a union without at least one member of nonzero
size. For example,
Mode: ANSI 3.5.2.1
For example:
printf("This is a string\n" , );
Do not omit an argument in a function call.
Mode: ANSI 3.3.2
The compiler cannot open the file file_name to read information
about intrinsics appearing in the #pragma intrinsic directive.
This error is issued when an intrinsic pragma is seen. If no intrinsics
are declared in a file, the existence of the intrinsic file is not checked.
For example, assuming /no_root/no_file does not exist,
Information about func_name is not contained in the current intrinsic
file file_name that the compiler is using.
Check the spelling of the intrinsic in the intrinsic pragma.
Make sure the correct intrinsic file is current. For example,
More arguments appear in a call to an intrinsic than are correct for
that intrinsic.
Remove the unnecessary arguments from the argument list on the call.
An argument to an intrinsic function, argument number, is not
the proper type and cannot be converted to the proper type.
Pass the proper type argument in the number position. It is unlikely
that a simple cast can be used to convert the argument to the correct type,
as the compiler will first attempt to convert the argument to the proper
type when an intrinsic function is called.
Fewer actual arguments appear in a call to an intrinsic than are correct
for that intrinsic.
Insert the necessary arguments into the argument list in the call.
A parameter to an intrinsic function, parameter number, requires
an alignment that cannot be specified by HP C. This error occurs on the
line of the intrinsic pragma, not the line of a call.
The specified intrinsic cannot be called from HP C as an intrinsic.
Remove the intrinsic pragma. If you defined the parameter alignment
in an intrinsic file (using Pascal/HP-UX), relax the alignment requirement
of the parameter, if feasible. It is still possible to call the function,
but not as an intrinsic.
The intrinsic function func_name returns a type that cannot be
specified by HP C. This error occurs on the line of the intrinsic
pragma, not the line of a call.
The specified intrinsic cannot be called from HP C as an intrinsic.
Remove the intrinsic pragma. If you defined the return type in
an intrinsic file (using Pascal/HP-UX), modify the return type to one that
maps into HP C, if feasible. It is still possible to call the function
as an external, but not as an intrinsic.
A parameter to an intrinsic function, parameter number, requires
a type that cannot be specified by HP C. This error occurs on the line
of the intrinsic pragma, not the line of a call.
The specified intrinsic cannot be called from HP C as an intrinsic.
Remove the intrinsic pragma. If you defined the parameter type
in an intrinsic file (using Pascal/HP-UX), modify the type to one that
maps into HP C, if feasible. It is still possible to call the function,
but not as an intrinsic.
A parameter to an intrinsic function, parameter number, requires
a call method that cannot be specified by HP C. This error occurs on the
line of the intrinsic pragma, not the line of a call.
The specified intrinsic cannot be called from HP C as an intrinsic.
Remove the intrinsic pragma. If you defined the parameter call
method in an intrinsic file (using Pascal/HP-UX), modify the call method
to one that maps into HP C, if feasible. It is still possible to call the
function, but not as an intrinsic.
The file the compiler is currently using to gather information on intrinsics
exists but cannot be read properly.
If you are reading your own intrinsic file (created by the Pascal/HP-UX
compiler), try rebuilding the file.
When switching to a new intrinsic file (via the intrinsic_file
pragma), or at the end of compilation, the intrinsic file currently open
cannot be closed.
Verify that the intrinsic file is valid.
An argument to an intrinsic function, argument number, is an
address of some variable that is not the same size expected by the intrinsic.
For example, a pointer to a 24-character array is passed when a pointer
to a 48-character array is expected. This error can only occur when passing
"generic" structures (struct, union, array) to the intrinsic by reference.
Pass an address of a correct size variable in the number position,
a variable at least the size of the one expected by the required intrinsic.
Casting a pointer to point to an object of the correct size will eliminate
this error. However, this is unlikely to be the proper solution because
the data will be stored at the address as if the size were correct.
A call to an intrinsic function appears in a file before the intrinsic
pragma which declares the function.
Move the intrinsic pragma declaring the function before any
call to the function. It is a good idea to put all intrinsic pragmas
at the start of a file for this reason, to avoid other errors and warnings
about problems such as mismatched return types, that arise from the mixed
use of extern and intrinsic pragma declarations.
A parameter to an intrinsic function, parameter number, has a
default value longer than the current maximum allowed by HP C--eight bytes.
This error occurs on the line of the intrinsic pragma, not the
line of a call.
The specified intrinsic cannot be called from HP C as an intrinsic.
Remove the intrinsic pragma. If you defined the parameter default
value in an intrinsic file (using Pascal/HP-UX), modify the size of the
default value to be less than or equal to eight bytes, if feasible. It
is still possible to call the function, but not as an intrinsic.
An argument to an intrinsic function, argument number, is not
the proper size. This error can only occur when passing a generic structure
(struct, union) to an intrinsic by value.
Pass an argument of the proper size in the number position.
An argument to an intrinsic function, argument number, is an
address of some variable that is not the same type expected by the intrinsic.
For example, a pointer to a short int is passed when a pointer to an int
is expected.
Pass an address of the correct type of variable. Casting to the correct
pointer type will eliminate this error. However, this is unlikely to be
the proper solution because the data will be stored in the argument as
if the correct type pointer was passed. For example, if the intrinsic IFUNC()
expects a pointer to a short int, and assuming it sets a value at the address
passed, a call such as
You may be passing a pointer to an array, but the size of its elements
is not known.
Define the object being pointed to, so that the compiler knows its size.
An actual argument was omitted in a call to a function, and that function
was not declared as an intrinsic.
Add the intrinsic declaration (that is, #pragma INTRINSIC intrinsic_name)
to the translation unit. If the function being called is not an intrinsic,
supply the missing argument(s).
An argument to an intrinsic function, argument number, was omitted
but does not have a default value defined.
You must supply a value for the argument.
The intrinsic function name you specified exceeds 31 characters in length.
Shorten the function name to 31 characters or less.
The storage-class specifiers auto and register may
not be used in the declaration specifiers in an external declaration.
Change the storage-class specifier to extern or static.
Mode: ANSI 3.7
An object that has static storage duration is being initialized with
an address, but the object is not long enough to contain an address. For
example,
Declarations may use only one of the following storage class specifiers:
auto,
static, extern, register, or
typedef.
A declaration using two or more of these occurs in the translation unit.
Remove the extraneous storage class specifier.
Mode: ANSI 3.5.1
You have used the unary plus operator with a nonarithmetic operand.
Replace the nonarithmetic operand with a valid operand for the unary
plus operator.
Mode: ANSI 3.3.3.3
Your translation unit has a declaration using the same type specifier
twice, such as int int i;.
Eliminate the duplicate type specifier.
Mode: ANSI 3.5.2
A digit of 8 or 9 is detected inside an octal constant.
Make sure only digits 0 to 7 are used in octal constants.
Mode: ANSI 3.1.3.2
It is illegal to apply the sizeof operator to bit-fields.
Remove the invalid sizeof expression.
Mode: ANSI 3.3.3.4
It is illegal to apply the sizeof operator to function names.
Remove the invalid sizeof expression.
Mode: ANSI 3.3.3.4
If both arms of a conditional expression are pointers, they must point
to the same type, or one must be a pointer to void.
Correct the types of the expressions (possibly by inserting a cast).
Mode: ANSI 3.3.15
A integer can be combined with a pointer in a conditional expression
only if it is a constant integral expression with the value 0 (a null pointer
constant).
Correct the types of the expressions (possibly by inserting a cast).
Mode: ANSI 3.3.15
If both operands of a relational operator are pointers, they must point
to compatible types.
Correct the types of the operands (possibly by inserting a cast).
Mode: ANSI 3.3.8
An integer cannot be combined with a pointer in a relational expression.
Correct the types of the operands (possibly by inserting a cast).
Mode: ANSI 3.3.8
A sub-expression with type void cannot be used in an expression.
Correct the expression.
Mode: ANSI 3.2.2.2
You've specified a 64-bit integral constant for a case label but the
type of the switch expression is a 32-bit integer; example:
The switch expression contains the long long type, which is
too large. For example:
Your translation unit has a declaration using the same type qualifier
twice, such as const const int i;.
Eliminate the duplicate type qualifier.
Mode: ANSI 3.5.3
A function definition is a mixture of prototype and old-style formats,
such as int func (char *) char *b;.
Function definitions must be in either prototype or old-style forms;
change the definition to one or the other.
Mode: ANSI 3.7.1
Parameters may have no storage class other than register.
Remove the offending specifier.
Mode: ANSI 3.7.1
Your translation unit contains an ill-formed function definition, such
as int func {} (no parentheses are present).
Change the function definition to be syntactically correct.
Mode: ANSI 3.7.1
You have initialized an array with a single expression without braces.
Surround the initializer with braces.
Mode: ANSI 3.5.7
You've specified -Aa without the +e option for the
long
long data type.
Either add the +e option or use -Ae.
You have attempted to use the unary plus operator in Compatibility mode.
Either take out the unary plus operator or compile with the -Aa
option.
You have attempted to use the U suffix on an integer literal
in Compatibility mode.
Either take out the unsigned suffix U or compile with the -Aa
option.
You have attempted to use the F or L suffix on a real
literal in Compatibility mode.
Either take out the float suffix F or the long suffix L,
or compile with the -Aa option.
You have attempted to use wide character constants in Compatibility
mode.
Either take out the wide character constants or compile with the -Aa
option.
You have attempted to use wide string literals in Compatibility mode.
Either take out the wide string literals or compile with the -Aa
option.
You have attempted to use function prototypes in Compatibility mode.
Either take out the function prototypes or compile with the -Aa
option.
The type specifier void is permitted in a prototype function
declaration only when it is the only parameter in the list. It signifies
that the function takes no arguments.
Remove the extra declarators from the parameter list in the function
declaration, or remove the void type specifier.
Mode: ANSI 3.5.4.3
The use of an ellipsis signifies that the remaining arguments are optional.
It may only appear as the last element in a parameter list.
Reorder the parameters so that the ellipsis appears last in the list.
Mode: ANSI 3.5.4.3
You have attempted to use the long double type specifier in
Compatibility mode.
Either take out the long double type specifier, or compile
with the -Aa option.
An abstract declarator is used in a function definition. Abstract declarators
in a parameter list may only appear in a function declaration.
Mode: ANSI 3.7.1
A function has been redeclared (or defined after a declaration) with
a parameter list that is not the same as the one on the prior declaration.
Correct the parameter lists so that they are both the same.
Mode: ANSI 3.5.4.3, 3.1.2.6
You have specified a type with unknown size as the return type of a
function. This typically occurs when a function is declared as returning
a struct or union, and the struct or union body is never defined.
Ensure that the struct or union body is defined before the function
definition.
Mode: ANSI 3.7.1
An object or function has been illegally redeclared.
Remove the second illegal declaration.
Mode: ANSI 3.5
An object may be initialized no more than once.
Remove the duplicate initialization.
Mode: ANSI 3.7
You have attempted to initialize a union in Compatibility mode.
Either remove the union initializer, or compile with the -Aa
option.
You have attempted to initialize an automatic aggregate in Compatibility
mode.
Either remove the auto aggregate initializer, or compile with the -Aa
option.
You have attempted to specify a union bit-field in Compatibility mode.
Either remove the specify a union bit-field or compile with the -Aa
option.
The types of the LHS and RHS of an assignment are incompatible. For
example, you might have mixed a struct and a pointer in the assignment.
Correct the types of the expression in the assignment.
Mode: ANSI 3.3.16.1
In a subscript expression (a[b]), one operand must be an integral
expression, and the other expression must be a pointer to an object of
known size (that is, not an incomplete pointer or a pointer to void).
Correct the types of the operands of the subscript expression.
Mode: ANSI 3.3.2.1
You have violated the rules about the allowable types for the operands
of a relational operator. Both operands must have arithmetic type, or both
must be pointers to compatible types. For example, you cannot compare two
structures.
To compare two structures, compare them one element at a time. To
compare pointers that don't point to compatible types, cast one or both
so that they are compatible.
Mode: ANSI 3.3.8
You have violated the rules about the allowable types for the operands
of an equality operator. For example, you cannot compare two structures.
To compare two structures, compare them one element at a time. In
other cases, you may be able to achieve the desired result using casts.
Mode: ANSI 3.3.9
In a prototype in a function declaration, at least one fixed parameter
declaration must precede an ellipsis (that is, the following declaration
is illegal):
Long float is a synonym for double in compatibility mode only.
Change the type specifier to double.
Mode: ANSI 3.5.2
Your program dereferences a pointer to an incomplete type. The object
to which the pointer points must be an object type or a function type.
Complete the type that the pointer is pointing to.
A character array is initialized with an illegal initializer, such
as a cast of a string literal.
The type of an array is function. For example,
Only the first dimension of an array declaration can use empty brackets
([ ]). For example,
Specify the size of each subsequent dimension of the array after the
first element. In the example above, specify
The expression specifying the size of an array is not a constant. For
example,
The expression specifying the size of an array is not an integral constant
expression. For example, although 4*2/1.6 evaluates to 5, the value is
converted to type float (5.000) because of the value 1.6.
However, the declaration
Use a cast or change the expression so it evaluates to an integer value.
For example,
The expression specifying the size of an array evaluates to a number
that is not greater than zero. For example,
The return type of a function is declared to be function or array. For
example,
A function declarator that is not part of a function definition has
an identifier list that is not empty. For example, func(a,b);.
You might have inadvertently put a semicolon after a function declarator.
If not, remove the identifier list from the external declaration.
Mode: ANSI 3.5.4.3
The program attempts to declare a register global. For example,
Remove the register class specifier from the declaration.
Mode: ANSI 3.7
Your program uses an illegal combination of types. For example,
Your program assigns a nonconstant to an enumeration constant. In the
following example, blue = i is flagged as an error.
Mode: ANSI 3.5.2.2
The expression defining the value of an enumeration constant is not
an integral constant expression. For example,
Your program gives a bit-field within a structure a nonconstant size.
In the following example
Use an integral constant expression to specify the size of a bit-field.
Change the struct-declarator above to
int df : 15;
Mode: ANSI 3.5.2.1
The type of a bit-field is not integral. For example,
Mode: ANSI 3.5.2.1
Your program specified a bit-field size that is greater than the size
of an int (32 bits) or less than zero. For example,
Mode: ANSI 3.5.2.1
You attempted to initialize an illegal type with a string initializer.
For example:
The string used to initialize an array of character type contains more
characters than specified by the size of the array. (Remember that the
terminating null character will not be appended to the array unless there
is enough room for it.) For example,
Mode: ANSI 3.5.7
Your program attempts to initialize a typedef name as if it were a variable.
For example,
Your program attempts to initialize an imported variable that is declared
extern, and whose proper definition appears elsewhere. For example,
You have initialized a function, such as static int func() = 3;.
Remove the initialization from the function declaration.
Mode: ANSI 3.5.7
An initializer for an object with static storage duration is not a valid
constant. Such a constant must be an arithmetic constant expression, a
null pointer constant, an address constant, or an address constant plus
or minus an integral constant expression. For example,
Your program initializes a pointer to a noninteger. For example,
An initializer list contains more initializers than elements in the
object being initialized.
The initializer contains more levels of nested braces than is allowed.
For example,
Mode: ANSI 3.5.7
A switch statement contains more than one default
label. For example,
Mode: ANSI 3.6.4.2
Two case expressions in the same switch statement
have the same value. For example,
Mode: ANSI 3.6.4.2
Your cast expression attempted an illegal conversion. For example:
In a subscript expression, one of the expressions must have pointer
type and the other must have integral type. For example:
Mode: ANSI 3.3.2.1
The left operand of a . operator is not a struct or union.
For example,
Your program uses an undefined variable as the left operand of a .
operator. For example:
The second operand of a . operator or a - operator
does not name a member of the corresponding structure or union. For example,
The left operand of a reference operator (-) is not a pointer.
For example,
Your program does not call a function correctly. For example,
The program attempts to use a function pointer in an arithmetic expression.
For example:
If this is really what you want, cast the function pointer to an integer.
i = j + (int) fp;
Mode: ANSI 3.3
Your program uses nonintegral operands with a bitwise operator. Examples
of nonintegral expressions are pointers, floats, functions, arrays, structs,
and unions. Bitwise operators are: |, ^, and &.
For example,
The expression used for initializing a variable is too complex to be
determined at link time. Usually this is due to using an expression involving
an address minus an address or an address plus an address. For example:
You have not followed the rules for the operand types in a relational
expression or an equality expression.
Make sure you are comparing the correct objects. You could have used
an array name instead of an element in an array, or you could have used
a struct or union name without accessing a member. Either compare the correct
objects or cast the operand to the appropriate type.
Mode: ANSI 3.3.8, 3.3.9
The operands to a shift operator ( or ) are not of integral type.
For example,
A pointer was declared without fully defining the object it points to;
such a pointer cannot be manipulated arithmetically because the size of
the object is unknown. For example,
Fully declare the type of the object pointed to. For example,
Mode: ANSI 3.3.6
One operand to an addition operator is a pointer, but the other does
not have integral type. For example,
The first operand of a subtraction operator has integral type and the
second operand is a pointer. For example,
Your program uses a nonarithmetic type with one of the following operators:
+,
-, *, /, or %. Arithmetic types include floating types, integer
types, character types, and enumerated types. For example,
e = (int)ptr *2;
Mode: ANSI 3.3
The operands to a modulus operator (%) do not both have integral
type. For example,
Your program uses nonscalar operands with a logical operator. Scalar
types include arithmetic types and pointer types. Examples of nonscalar
types are structs and unions. Logical operators are: <esc|&&|
and ||.
Check whether a struct or union name was used without specifying a member.
Mode: ANSI 3.3.13, 3.3.14
Your program initializes an object with static storage duration, using
an illegal initialization expression, such as with a function call:
Your program does not use an lvalue on the left side of the assignment
operator. Some non-lvalues are array names without the subscript, function
names, and enumeration constants. For example,
The first operand of a conditional expression does not have scalar type.
For example,
This error occurs when the second and third operands in the conditional
expression have mismatched types, or one is a pointer and the other is
a nonzero integer. For example,
The indirection operator (*) is being applied to a nonpointer. For example,
The operand of the unary <esc|&| operator must be a
function designator or an lvalue.
The address-of operator (&) is being applied to a register
variable. For example,
The operand to a unary minus operator (-) does not have arithmetic
type. For example,
The operand to a not operator (!) does not have scalar
type. For example,
The operand to a complement operator (~) does not have integral
type. For example,
Your program uses a non-lvalue with either pre-increment (<esc|++|var),
post-increment (var<esc|++|), pre-decrement (--var),
or post-decrement (var--) operators. Non-lvalues include
constants, functions and other expressions that cannot be assigned to or
modified. For example,
Your program uses a nonscalar operand with the <esc|++|
or -- operator. For example, this occurs when you try to use <esc|++|
or -- with a struct or union name. For example,
The address-of operator (&) is being applied to a bit-field.
The expression in an if statement does not have scalar type.
For example,
The controlling expression in a while statement does not have
scalar type. For example,
The controlling expression in a do statement does not have
scalar type. For example,
The controlling expression in a for statement does not have
scalar type. For example,
The controlling expression in a switch statement does not have
integral type. For example,
A case statement is not inside a switch statement.
For example,
struct { int a : 3;
int : 0;
int c : 18;
} s1;
struct { int a : 3;
int c : 18;
} s1;
struct { int a : 3;
int b : 3;
int c : 18;
} s1;
Error 1582
Redeclaration of parameter "parm" in parameter list.
void func (parm1, parm2, parm2)
int parm1, parm2, parm3;
{ }
Check that you have spelled all your parameter names correctly.
Error 1584
Inconsistent type declaration: "name".
main() {
char func();
printf("%s\n",func());
}
char *
func() {
return("absH");
}
Decide what type the function should be and make the definition and all
declarations of the function agree in type. In the example above, change
the declaration in main() to char *func();.
Error 1586
Redefinition of function "function".
func() { }
main() {
int func();
}
func() { }
Remove any duplicate function definitions. Make sure that different functions
all have unique names.
Error 1587
Redeclaration of tag "name".
struct x {
int a;
};
struct x {
int b;
};
Remove the member declarations from one of the struct or union declarations,
or change the tag to a name that does not conflict.
Error 1588
"name" undefined.
main() {
i = 3;
j = i;
}
First check for misspellings of a declared identifier. If there are no
misspellings, define the variable. For example,
main() {
int i, j;
i = 3;
j = i;
}
Mode: ANSI 3.3.1
Error 1589
"name" is not a function.
extern int f;
main() {
printf( "%d\n", f() );
}
Check to see if you misspelled the name of the function and check to see
if you left the parentheses off an external declaration of the function.
For example,
extern int f();
main() {
printf( "%d\n", f() );
}
Mode: ANSI 3.3.2.2
Error 1590
"name" is not a typedef name.
int i;
typedef i;
i x;
Make sure you did not misspell the name of the type and check that your
typedef declaration was complete with the meaning you intended. For example,
typedef float i;
i x;
Mode: ANSI 3.5.2
Error 1592
Redefinition of label "name".
main() {
int j;
goto LABEL;
LABEL: j = 100;
LABEL: j = 101;
}
Change the name of one of the labels so that it does not conflict. Make
sure you need a label in each of the places. For example,
main() {
int j;
goto LABEL;
LABEL_1: j = 100;
LABEL: j = 101;
}
Mode: ANSI 3.1.2.1
Error 1594
The sizeof operator cannot be applied to types with unknown size.
i = sizeof (struct x);
Use a valid expression for the operand.
Error 1595
Redeclaration of members.
struct x { int member_a; }
struct x { int member_b; }
Change the tag of the second structure to a tag name that has not already
been used.
Error 1596
Typedef specifier before a function definition.
typedef f(){return 7;} F7;
typedef int func() { }
Define a type to be a pointer to a function. For example,
typedef int (*PG8)();
defines PG8 to be the type "pointer to function returning int".
Error 1597
Long pointers may not be initialized.
Error 1599
Illegal function pointer initialization.
struct {
int (*q)();
int g;
}func;
int (*f)() = func;
Check the initializer. You might have left off a member selector or array
subscript, or used a period (.) instead of a comma (,)
to separate initializer items. For example,
int (*f)() = func.q;
Mode: ANSI 3.5.7
Error 1600
Type clash on initialization.
char f = 'a';
char * title = f;
Make sure that this is what you want to do. If it is, cast the initializer
to the appropriate type. For example,
char * title = (char *)f;
Mode: ANSI 3.5.7
Error 1601
Initialization of integer with pointer.
int p;
int x = <esc|&p|;
Make sure that this is what you want to do. If it is, cast the pointer
to int. For example,
int p;
int x = (int)<esc|&p|;
or
int x = p;
Mode: ANSI 3.5.7
Error 1602
Cannot initialize struct of unknown size.
struct y z = {0,1,2};
Make sure the members of the structure have been declared. For example,
struct y {
int a,b,c;
} z = {0,1,2};
Mode: ANSI 3.5.7
Error 1603
Incompatible operands: operator operator.
float f = 3.44;
char * title1 = f;
struct { int i; char *cptr; } w, arr[4];
char *y;
w = y;
w = arr;
Check the operands. You might have left off a member selector or array
subscript. If you want to use the operands with the operator, cast the
operand(s) to the appropriate type(s), such as:
float f = 3.44;
char * title2 = (char *)f;
struct { int i; char *cptr; } w, arr[4];
char *y
w.cptr = y;
w = arr[2];
Mode: ANSI 3.3
Error 1608
Function argument may not be of type void.
Error 1610
Attempting to return value from function of type void.
void f()
{ return 23; }
Remove the expression from the return statement, or change the
function return type. For example,
f()
{ return 23; }
or
void f()
{ return; }
Error 1612
Bit-field size is too long for specified type or is not an integral
constant.
struct S {
int af : 10; /* OK. int is 32 bits long*/
char bf : 10; /* Not OK; char type = 8 bits. */
char bf : 4; /* OK. */
short cf : 20; /* Not OK; short type = 16 bits. */
} st;
Use a field size that is not greater than the bit size of the specified
type.
Error 1613
Zero-sized struct.
struct s {
struct {
int i;
int j;
};
struct {
int b: 0;
} st;
} SS;
Verify the member declarations for correctness. Verify that all members
have a specified nonzero size. Make sure that all arrays are dimensioned
properly. Also make sure that all members (except for bit-fields) are named.
In the above example, the first structure is unnamed, and so it does not
declare a valid member. The second structure has a size of zero.
Error 1614
Zero-sized union.
union {
struct {
int b;
char c;
};
struct {
int b : 0;
} s;
} un;
Verify that the members of the union in question are what you really want.
Make sure that any members that are structures or unions are named, that
all other members (except for bit-fields) are named, and that inner arrays
have the correct dimensions. In the example above, the first inner structure
needs a name and the second structure needs a nonzero member.
Error 1615
Default parameter specification not supported.
Error 1616
Unable to open intrinsic file "file_name".
#pragma intrinsic FOPEN
/*The default file /usr/lib/sysintr is used */
#pragma intrinsic_file "/no_root/no_file"
#pragma intrinsic MYINTRINSIC
/* The error is issued here. If this */
/* declaration was not here, no attempt would */
/* be made to access "/no_root/no_file" */
If you are not specifying alternative intrinsic files via the intrinsic_file
pragma, check for existence of the default file, /usr/lib/sysintr
on your system. If specifying your own intrinsic files, make sure you did
not misspell the filename in the intrinsic_file pragma and check
for the existence of the file.
Error 1617
Function "func_name" is not in intrinsic file "file_name".
#pragma intrinsic_file "myfile"
#pragma intrinsic myfunc1, myfunc2, myfunc3
#pragma FOPEN, FCLOSE, FWRITE
will cause the compiler to check for FOPEN, FCLOSE, and FWRITE in "myfile",
where the probable intent was to have the compiler check /usr/lib/sysintr.
The default file for the compiler is used afterwards.
#pragma intrinsic_file ""
is seen, or if no intrinsic_file pragmas are in the source file.
Error 1619
Too many arguments for function.
Error 1620
Argument number is not the correct type.
Error 1621
Too few arguments for function.
Error 1622
Alignment of intrinsic parameter number not supported.
Error 1623
Type of intrinsic "func_name" not supported.
Error 1624
Type of intrinsic parameter number not supported.
Error 1625
Call method of intrinsic parameter number not supported.
Error 1626
Intrinsic file info for parameter number is corrupt.
Error 1627
Unable to close intrinsic file "file_name".
Error 1628
Argument number points to type with incorrect size.
Error 1629
Intrinsic function "func_name" called before declared.
Error 1630
Default value for intrinsic parameter number too long.
Error 1631
Argument number is not the correct size.
Error 1632
Argument number points to incorrect type.
int *pint;
IFUNC( (short int *) pint );
will store the data in the least significant 16 bits of the word pointed
to by pint, while a dereference of pint will yield the
entire 32 bits pointed to with the rightmost bits containing garbage.
Error 1633
Cannot subscript array of objects of unknown size.
Error 1634
Missing arguments only allowed on intrinsic calls.
Error 1635
Argument number cannot be defaulted.
Error 1637
Intrinsic function name too long.
Error 1638
Global variable "variable" may not have automatic storage
class.
Error 1639
Size of object being initialized is too small to hold an address.
int var;
short int addr = (short int) <esc|&var|;
main () {}
The safest and most portable solution is to declare the object as a pointer.
For example, both of the following initializations are valid.
int var;
int *ptr1 = <esc|&var|;
void *ptr2 = (void *) <esc|&var|;
main () {}
Mode: ANSI 3.5.7
Error 1640
Too many storage class specifiers: "specifier" ignored.
Error 1641
Unary plus takes an arithmetic operand.
Error 1642
Duplicate type specifier "specifier": ignored.
Error 1643
Octal constants contain digits greater than 7.
Error 1644
Sizeof operator may not be applied to bit-fields.
Error 1645
The sizeof operator may not be applied to function names.
Error 1646
Illegal pointer combination for second and third operands of conditional
expression (?:).
Error 1647
Illegal integer-pointer combination for second and third operands of
conditional expression (?:).
Error 1648
Illegal pointer combination for "operator": Pointer types
are incompatible.
Error 1649
Illegal integer-pointer combination for operator.
Error 1650
Illegal to use void type as part of an expression.
Error 1653
The case label exceeded the precision of the type of switch expression.
int i
switch (i) {
case 0x7FFFFFFFFFFFFFFF:
Reduce the case label to a 32-bit integral type.
Error 1654
Expression type is too large for switch expression.
long long foo;
switch (foo) {
Change the type of switch expression to acceptable types such as long,
int,
etc.
Error 1675
Duplicate type qualifier "qualifier": ignored.
Error 1676
Prototypes and old-style parameter declarations mixed.
Error 1677
Parameter type has an invalid storage class specifier "specifier".
Error 1678
Invalid declarator in function definition.
Error 1679
Array initializer must be brace-enclosed.
Error 1681
Must use +e or -Ae for long long in ANSI mode.
Error 1700
Unary plus is an ANSI feature.
Error 1701
Unsigned suffix is an ANSI feature.
Error 1702
Float or long suffix is an ANSI feature.
Error 1703
Wide character constants are an ANSI feature.
Error 1704
Wide string literals are an ANSI feature.
Error 1705
Function prototypes are an ANSI feature.
Error 1707
Illegal void parameter list specification.
Error 1708
Ellipsis must be last on a parameter list.
Error 1709
Long double is an ANSI feature.
Error 1710
Missing parameter name in function definition's parameter list.
Error 1711
Inconsistent parameter list declaration for "function".
Error 1712
Illegal return type for function "function".
Error 1713
Illegal redeclaration for identifier "identifier".
Error 1714
Identifier "identifier" is initialized more than once.
Error 1715
Union initialization is an ANSI feature.
Error 1716
Automatic aggregate initialization is an ANSI feature.
Error 1717
Bit fields in unions is an ANSI feature.
Error 1718
Types are not assignment-compatible.
Error 1720
Subscript expression must combine object pointer and integer.
Error 1721
Operands for operator must be of arithmetic type or pointers
to compatible types.
Error 1722
Operands for operator must be of arithmetic type or pointers
to compatible types.
Error 1723
At least one fixed parameter is required when using an ellipsis.
int func(...);
Insert a declaration for the first parameter before the ellipsis, as
in:
int func (int parm1, ...);
Mode: ANSI 3.5.4.3, 3.5.4
Error 1724
Long float is not a valid ANSI type combination.
Error 1726
Cannot dereference a pointer to incomplete type.
Error 1748
Initializer is not a string literal.
Remove the cast, or change the type being initialized to a pointer
rather than an array.
Error 1500
An array of functions is not allowed.
char g(void) { return('a'); }
main()
{
char f[4]();
f[0] = g;
printf("%c\n",f[0]());
}
Use type pointer to function. For example,
char g(void) { return 'a'; }
main()
{
char (*f[4])();
f[0] = &&g;
printf("%c\n",f[0]());
}
Mode: ANSI 3.1.2.5
Error 1501
Only the first dimension of an array may be omitted.
int arr[ ][ ][4], brr[4][3][ ];
are incorrect declarations.
int arr[ ][2][4], brr[4][3][1];
Mode: ANSI 3.1.2.5
Error 1502
Array size must be a constant expression.
int i = 4;
char arr[i];
Only use expressions that evaluate to a constant value at compile time.
For example, use the statements
char arr[4];
or
char arr[2+2];
Mode: ANSI 3.5.4.2
Error 1503
Array size must be integral.
int arr[4*2/3];
is acceptable because the expression specifying the size is an integral
constant expression.
int arr[(int) (4 * 2/1.6)];
or
int arr[4*20/16];
Mode: ANSI 3.5.4.2
Error 1504
A zero or negative array size is illegal.
int arr[2*4/-3-5]; /* evaluates to int arr[-7]; */
Because declaring an array of negative dimension has no meaning, check
the expression and change the declaration to evaluate to a positive number.
For example, the above declaration might have been intended to be
int arr[2*4/-(3-5)];
which evaluates to
int arr[4];
Mode: ANSI 3.5.4.2
Error 1505
Function may not return a function or an array.
main()
{
char f()[4]; /* function returning array */
char g()(); /* function returning function */
}
The function should be declared as returning pointers to the appropriate
type. For example,
main()
{
typedef Arr[4];
typedef Func();
Arr *f(); /* returns a pointer to array */
Func *h(); /* returns a pointer to a function */
}
Mode: ANSI 3.5.4.3
Error 1506
Parameters allowed in function definition only.
Error 1507
Register class may only be applied to locals.
register int var;
main() { }
The register class is used in an external declaration.
Error 1508
Illegal type combination.
long short i;
unsigned void x;
See the Chapter 3 for all variations of proper type combinations. An example
of a valid declaration is
unsigned short us;
Mode: ANSI 3.5.2
Error 1509
Enumeration value must be constant.
main()
{
int i = 44;
enum colors { red = 4, green, blue = i, yellow};
}
Only assign constant values to enumeration constants. The enumerator above
should have been blue = 44.
Error 1510
Enumeration constants must be integral or enum values.
main()
{
enum colors { red = 4, blue = 5.65, yellow = red,
green = 'a'};
}
Only assign integral constant expressions to enumeration constants. In
the example, these enumerators are legal:
red = 4
yellow = red
green = 'a'
However, the initializer
blue = 5.65
is not legal. It could be changed to
blue = 5
or
blue = 6
or
blue=(int) 5.65
Mode: ANSI 3.5.2.2
Error 1511
Bit-field size must be a constant.
main()
{
int i = 15;
struct S {
char c;
int bf : 2 * 3;
int df : i;
} st;
}
the struct-declarator
int bf : 2 * 3;
is acceptable, but
int df : i;
is not.
Error 1512
Bit-field type must be integral.
struct S {
float af : 5;
int pf[3] : 29;
int *ptr : 13;
} st;
Use an integral type for the type of a bit-field, such as int, char,
or enum tag. Do not use floats, pointers, or arrays. If
you want to conform to ANSI C, the only allowable bit-field types are int,
unsigned
int, and signed int.
Error 1513
Illegal bit-field size.
struct S {
int af : 32; /* acceptable */
int bf : -2; /* not acceptable */
} st;
Use a constant integer field size that is not less than zero and not greater
than the bit size of the declared type.
Error 1514
Illegal type for string initializer.
struct SS { int i; } s = {"abc"};
Check that the member type is correct. For example:
struct SS { char *c; } s = {"abc"};
Mode: ANSI 3.5.7
Error 1515
Initializer string too long.
char Str[4] = "12345";
Increase the size of the array, such as
char Str[5] = "12345";
Alternatively, decrease the size of the string initializer, such as
char Str[4] = "1234";
Or, let the compiler calculate the size needed for the array:
char Str[] = "12345";
In this case, a terminating null character will be appended to the array;
so, its size will be 6.
Error 1516
No initialization in typedef declaration.
typedef char * String = "hi there";
Do not use initialization in a typedef declaration. Because a typedef declaration
does not declare an object, you may not initialize it; the typedef name
is a synonym for a type. The example might be corrected as follows:
typedef char * String;
String Str_var1 = "hi there";
Mode: ANSI 3.5.7
Error 1517
Imported definition may not be initialized.
int global;
main()
{
int i = 10;
if (i 0){
extern int global = 1;
} i = 0;
}
Only initialize a variable when it is defined. For example,
int global = 1;
main()
{
int i = 10;
if (i 0) {
extern int global;
i = 0;
}
}
Error 1518
Function may not be initialized.
Error 1521
Incorrect initialization.
char *s = "hi there";
char * title = s; /* not constant */
main() { }
Either initialize the variable to a valid constant or at run-time, initialize
the variable to another variable that has been initialized. For example,
char * title = "hi there";
or
char *s = "hi there";
char * title;
main()
{
title = s;
}
Mode: ANSI 3.5.7
Error 1522
Cannot initialize a pointer with an integer constant other than zero.
int *p = 'a';
Pointers can only be initialized to constant integer expressions or to
an address plus or minus an integer constant. For example,
int i, * ptr = 46;
char * name = "The Title";
int *p = <esc|&i|;
Mode: ANSI 3.5.7
Error 1523
Too many initializers.
int arr[3] = {0, 1, 2, 3};
main()
{
static struct {int i; char c;} s = {4,'e',55};
}
Either increase the size of the object being initialized or decrease the
number of initializers. For example,
int arr[4] = {0, 1, 2, 3};
or
int arr[3] = {0, 1, 2};
and
static struct {int i; char c; int j;} s = {4,'e',55};
or
static struct {int i; char c;} s = {4,'e'};
Mode: ANSI 3.5.7
Error 1524
Initializer is too deeply nested.
int i = <esc|3;|
Remove unnecessary braces.
Error 1525
Duplicate default statements in switch.
switch (c) {
default: fprintf(stderr, "not an option.\n");
break;
case 'f': do_f(); break;
default: fprintf(stderr, "error\n"); break;
}
Remove one of the default labels.
Error 1526
Duplicate case constant (value) in switch.
switch (c) {
case 'f':
case 'g': do_f_or_g(); break;
case 'f': do_f(); break;
default: fprintf(stderr, "not an option. \n");
break;
}
Remove one of the case labels with the duplicate value.
Error 1527
Incompatible types in cast: Must cast from scalar to scalar or to void
type.
struct SS {int i; char j;} * s_ptr;
union UU {int a; char b;} u, *u_ptr = &&u;
s_ptr = (struct SS) u_ptr;
Either cast to void type, or make sure the type name specifies scalar type
and the operand has scalar type. For example:
st_ptr = (struct S *) un_ptr
Mode: ANSI 3.3.4
Error 1528
Subscript expression must combine pointer and integer.
arr[4.54] = 4;
Make sure that one of the expressions (typically the one outside of the
brackets) is a pointer and the other expression has integral type.
Error 1529
Cannot select field of nonstructure.
int st;
st.i = 4;
Change the left operand to have structure or union type. For example:
struct S {int i; char c;} st;
st.i = 4;
Mode: ANSI 3.3.2.3
Error 1530
Undefined struct or union.
main()
{
struct S *stp;
(*stp).i = 4;
st.i = 4; /* st undefined because struct S
hasn't been specified */
}
Define the variable to be a struct or union. Make sure you are using the
correct variable of the left side of the . operator. For example,
struct S { int i; char c; } st;
st.i = 4;
Mode: ANSI 3.3.2.3
Error 1531
Invalid member of struct or union.
main()
{
struct { int i; char c; } st, *p = <esc|&st|;
p-z = 4;
st.d = 'a';
}
First verify that the left side is the correct structure or union variable.
If it is, change the member (right side) to be the correct member (one
that was defined within the given struct or union). For the example above,
p-i = 4;
st.c = 'a';
Mode: ANSI 3.3.2.3
Error 1532
Reference through a nonpointer.
main()
{
int *q;
struct S { int i; char c; } s, *p=<esc|&s|;
s-i = 4;
}
First verify that the left side is the correct struct or union pointer
variable. Either use
s.i = 4;
or
p-i = 4;
Mode: ANSI 3.3.2.3
Error 1533
Illegal function call.
void f (int y, int z);
void g (enum a {A,B} x);
main()
{
int i = 10;
(* (i ? F: g)) ();
}
Call a function by checking if the function is being called directly or
indirectly through a pointer to the function.
Error 1534
Illegal to use a function pointer as "operator" operand
where an arithmetic type is required.
int (*fp)();
int f(){};
main()
{ int i,j;
fp = f;
j = 3;
i = j + fp; /* this is illegal */
}
It is illegal to use a function pointer in a context where an arithmetic
type is required.
Error 1535
bitop operator takes integral operands.
float f; int i;
i = f^i; /* incorrect usage because f is a float */
i &= f; /* incorrect usage because f is a float */
Check your program for the following:
Mode: ANSI 3.3.7
Error 1536
Cannot evaluate initialization expression, please initialize dynamically.
int i = 0,j = 0;
int a = (int) <esc|&i - (int) &j|;
main()
{
}
Initialize (assign) the variable dynamically. For example:
int i = 0,j = 0;
int a;
main()
{
a = <esc|(int) &i - (int) &j|;
}
Mode: ANSI 3.4
Error 1537
Illegal operand type for operator.
Error 1538
Shift operators take integral operands.
int *p, *q, i = 4;
q = p i;
Make sure you want to shift the indicated operand. If you do, cast the
operand to an int type.
q = (int*) ((int) pi);
Mode: ANSI 3.3.7
Error 1539
Cannot do arithmetic with pointers to objects of unknown size.
struct s *p;
main()
{ p++; }
This error may also be caused when a header file is not included.
struct s {
int a,b,c;
} *p;
main()
{ p++; }
Be sure that all necessary header files have been included.
Error 1541
Only integers may be added to pointers.
int *p, *q;
p = p + q;
p += q;
Make sure that this is what you want to do. If it is, cast the other operand
to int. For example,
p = p + (int)q;
p = (int)p + p;
p += (int)q;
Mode: ANSI 3.3.6
Error 1542
Pointer may not be subtracted from integer.
int i, *q;
i = i - q;
i -= q;
Make sure that this is what you want to do. If it is, cast the pointer
to int. For example,
i = i - (int)q;
i -= (int)q;
Mode: ANSI 3.3.6
Error 1544
"operator" operator requires arithmetic operands.
int *ptr, e;
e = ptr * 2;
Make sure that this is what you want to do. You could have used an array
name instead of an element of an array, or you could have used a struct
union name without accessing a member. If you do want to perform the operation
on a pointer, cast it to int:
Error 1545
Mod (%) operator takes integral operands.
double d = 66.666;
int i = 5;
i = d % i;
i %= d;
Cast the noninteger operand or operands to int. For example,
i = (int)d % i;
i %= (int)d;
Mode: ANSI 3.3.5
Error 1547
"logical" operator requires scalar operands.
Error 1548
Illegal initialization expression.
int i = zero();
Only use constant expressions to initialize objects with static storage
duration. For example,
int i = 0;
Mode: ANSI 3.5.7
Error 1549
Modifiable lvalue required for assignment operator.
enum color {red, green, blue};
int i=4, *p, arr[4];
int func();
green = red; /* green is a constant */
arr = p; /* arr is an array */
f() = i; /* f is a function name */
<esc|&i| = p; /* <esc|&i| cannot be assigned to */
Do not use a non-lvalue on the left side of an assignment. Enum constants,
functions, and other expressions produce a value that can never be assigned
to. Array elements can be assigned to but arrays as a whole cannot. However,
an array may be declared inside a struct, and that struct may be assigned
to:
struct {
int arr[10];
} a,b;
a = b;
Mode: ANSI 3.3.16
Error 1552
First expression of ?: must be arithmetic.
struct SS { int i,j; }s;
s.i = (s.j 906)?s:2;
Check the expression; you might have left off a member reference, an array
subscript, or a pointer indirection. For example,
s.i = (s.j 906) ? s.j : 2;
Mode: ANSI 3.3.15
Error 1553
Incompatible types in second and third operands of conditional expression
(?:) .
i = i ? i : ptr;
If you want to use expressions of different types, cast them to the same
type if it is reasonable to do so. Both result expressions can be arithmetic,
pointers of the same type, identical types, or one can be a pointer and
the other a constant integer expression with value zero (for null pointer).
For example,
i = i ? i : (int)ptr;
Mode: ANSI 3.3.15
Error 1554
Indirection must be through a pointer.
int i, p;
i = *p;
Make sure that this is what you want to do. If it is, cast the operand
to a pointer of the appropriate type. Otherwise, change the type to a pointer.
For example,
i = *(int *)p;
or
int i, *p;
i = *p;
Mode: ANSI 3.3.3.2
Error 1555
Address operator requires lvalue.
enum {red, blue, green};
int *p;
p = <esc|&4|;
p = <esc|&red|; /* where red is a constant. */
If you want a pointer to a variable with the value, use a temporary variable,
such as,
i = 4; p = <esc|&i|;
color = red; p = <esc|&color|;
Mode: ANSI 3.3.3.2
Error 1556
Address operator applied to register variable.
register index;
int *p;
p = <esc|&index|;
Remove the register storage class specifier from the variable declaration.
For example,
int index;
Mode: ANSI 3.3.3.2
Error 1557
Unary minus takes an arithmetic operand.
double *ptr;
-ptr;
Check the operand. You may have left off a member reference, an array subscript,
or a pointer indirection. For example,
-(*ptr);
Mode: ANSI 3.3.3.3
Error 1558
The not operator takes a scalar operand.
struct SS { int arr[10]; int j; } s;
if ( !s );
Check the operand. You might have left a member reference off a struct
or union name. For example,
if ( !s.j );
Mode: ANSI 3.3.3.3
Error 1559
Complement operator takes integral operand.
struct SS { int arr[10]; int j; } s;
int *p;
if (~s);
if (~p);
Check the operand. You might have left off a member reference on a struct
or union name or forgotten to dereference a pointer. For example,
if (~s.j);
if (~*p);
Mode: ANSI 3.3.3.3
Error 1560
Modifiable lvalue required with operator "operator".
int i, *p, arr[3];
i = --4;
p = arr++;
Only use modifiable lvalues with the <esc|++| and --
operators. The above examples might have been intended to be
i = 3;
p = arr + 1;
Mode: ANSI 3.3.2.4, 3.3.3.1
Error 1561
Increment and decrement operators take scalar operand.
int a;
struct { int i; char c; } st;
a = st--;
Check to see if you left off a member selection. Only use scalar operands
with <esc|++| and --. For example,
a = (st.i)--;
Mode: ANSI 3.3.2.4, 3.3.3.1
Error 1562
Cannot take the address of a bit-field.
struct { unsigned i : 4; unsigned *j; } s;
s.j = <esc|&s.i|;
Do not take the address of a bit-field. You might want to use the contents
of the bit-field or take the address of another member of the structure.
For example,
s.j = s.i;
s.j = (unsigned *)&&s.j;
Mode: ANSI 3.3.3.2
Error 1563
Expression in if must be scalar.
struct { int i; char c; } s;
if ( s );
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
if (s.i);
Mode: ANSI 3.6.4.1
Error 1564
Expression in while must be scalar.
int x, y;
struct { int i; char c; } st;
while ((x == y) <esc|&&| st);
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
while ((x == y) <esc|&&| st.c);
Mode: ANSI 3.6.5
Error 1565
Expression in do must be scalar.
struct { int i; char c; } s;
do { ; } while (s);
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
do { ; } while (s.i);
Mode: ANSI 3.6.5
Error 1566
Test expression in for must be scalar.
char array[12];
for (array = 0; array<= 2.0; array++) { ; }
Check the expression. You might have left off a member reference, an array
subscript, or a pointer dereference. For example,
for (array[0] = 0; array[0] <= 2.0; array[0]++) { ; }
Mode: ANSI 3.6.5
Error 1567
Switch expression must be an integral type.
float f;
int arr[3];
switch(f) {
default: break;
}
switch(arr) {
default: break;
}
If you want to switch on the value of the nonintegral type, cast the expression
to int. Otherwise, change the expression to have integral type. For example,
switch((int)f) {
default: break;
}
switch(arr[1]) {
default: break;
}
Mode: ANSI 3.6.4.2
Error 1568
Case statement is not enclosed by a switch statement.
switch (x) {
case 1: {}
}
case 2: {}
Check your program's braces. Problems with braces occur when an extraneous
brace prematurely terminates a switch statement, leaving a dangling statement
outside. For example,
switch (x) {
case 1: {}
&nb