| |||||
Technical Support Support Resources
Product Information | C251: PROBLEMS INITIALIZING ABSOLUTELY LOCATED VARIABLESInformation in this article applies to:
QUESTIONI declared two global variables in file main.c as follows: unsigned char near x _at_ 0x2000 = 5; unsigned char near y _at_ 0x3000 = 10; In the file main.h, I wrote: extern unsigned char near x; extern unsigned char near y _at_ 0x3000; main.h is included in main.c. On the map file generated, both x and y are not located at the desired locations. Why? ANSWERThis only happens when you initialize a variable located with the _at_ keyword when declaring the variable and the extern is in the same scope as the declaration. The solution is to arrange your project so that you do not have externs and declarations for the same variables in the same scope. The best way to do this is:
MORE INFORMATION
Last Reviewed: Friday, July 15, 2005 | ||||
| |||||