Keil Logo

C251: SYNTAX ERROR WHEN DECLARING A VARIABLE


Information in this article applies to:

  • C251 Version 2.14

SYMPTOMS

I am porting a program from the 8051 to the 251 and I have a variable declared using:

const code int x;

However, the compiler gives the following error:

Error 25: syntax error near 'int'

Changing 'code' to 'near' or 'far' gives the same result.

CAUSE

When declaring a variable using the C251 compiler, you must specify the variable type before the memory space.

RESOLUTION

Change your variable declaration to:

const int code x;

MORE INFORMATION

Refer to pages 96 and 97 in the C251 Compiler User's Guide (09.97) for further information on explicitly declared memory types and examples of variable declaration with memory type.

Last Reviewed: Tuesday, July 19, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.