Hi,
I am also facing similar kind of problem...
I have created a structure and created a global variable of that structure.
After creation of the variable, in the next line I was trying to initialize one member of that struture. However, in CodeWarrior compiler, i was getting declaration syntax error for that statement.
However, when i wrote the same statement inside a function, i was able to compile teh code successfully.
I didnt get why this is happening....
Could any one help me to sort this problem?
here is an example:
//////////////////////// aa.h //////////////////////////
typedef struct
{
int a;
int b;
} St;
////////////////////////// bb.c //////////////////////////////
#include "aa.h"
St str_bb;
str_bb.a = 100;
void func (void)
{
....
...
}
*********************************************
i was getting the compilation error at the statement: str_bb.a = 100;
Cant we initialize single element of a structure variable gloabally?
The strange thing was, when i put that statement inside the function body of func(), i was able to compile the code.....