| ||||||||
Technical Support Support Resources Product Information | C51: INITIALIZING AN ABSOLUTELY LOCATED VARIABLEInformation in this article applies to:
QUESTIONI have declared a global variable using: unsigned char xdata foo _at_ 0x2000 = 5; However, upon compilation I get the following error: Error 274: 'foo': absolute specifier illegal How can I initialize an absolutely located variable? ANSWERYou cannot both specify a location for a variable and initialize it at the same time. The best solution is to initialize the variable seperately in an intitialization routine. For example:
void init_globals(void)
{
foo = 5;
}
which is then called from the main function. MORE INFORMATION
SEE ALSO
FORUM THREADSThe following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Friday, July 15, 2005 | |||||||
| ||||||||