This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

global variables not initializing to declared values

Maybe I have some setting wrong in my project. At the beginning of my main source file, I include a header that declares several variables as externs. Then I declare and initialize them after the #include.

Main Source:

#include <header.h>
...
const char DEVICE_NAME[] = "ELC";
const char VERSION_NUMBER[] = "F1.0M1.0";
const char CONTROL_PANEL = 1;
...
void main(void)
{
    ...
}

Header (header.h):

#ifndef _HEADER_H
#define _HEADER_H
...
extern char DEVICE_NAME[],VERSION_NUMBER[],CONTROL_PANEL;
...
#endif

The variables are then used in implementation code in another file. This other file and the header are common to several projects that I'm working. (I have restructured my projects per our last discussion.)

The problem that I'm experiencing is that all of the data is initialized to 0 at the beginning of main() rather than the specified values. I don't have any of the .A51 initialization files in my project, so what could be causing this?

Thanks.

0