ARM Technical Support Knowledge Articles

SYNTAX ERROR WHEN DECLARING A VARIABLE

Applies to: C251 C Compiler

Answer


Information in this article applies to:


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.

Article last edited on: 2005-07-19 10:06:39

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential