I am facing a weird problem I have defined I a structure in a C header file:
typedef struct iRecActive{
char iRecSID[32];
unsigned char RecStatus;
I tried to find solution for similar problem but I didn't find it on stack. I leave here answer for other people, to save their time:
Because it is C, you cannot create your variables where you want. They must be created at the beginning of statement. So this is correct:
if(true) {
iRecActive_t myRecActive;
//calculations
Mutex_Lock(somemutext);
variable = 14;
And this is incorrect:
if(true) {
//calculations
Mutex_Lock(somemutext);
variable = 14;
iRecActive_t myRecActive;
In last example you get error message: illegal use of this type as expression or some other similar, very useful errors.
Proper question is here, but it was marked as duplication (it is not!): typedef stuct problem in C (illegal use of this type as an expression)
Regards, Ikeban
change iRecAcitve_t
to iRecActive_t
.