Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
October 13, 2009 - 10:12am
|
Hi To All Can someone tell me why this kind of struct union has issue in compiling: typedef union Thank's to all Ipur. |
bit and data are reserved keywords (space qualifiers). You may not use them as identifiers.
The following code will be ok:
PS
Key words usually appear in a different color (red in my case)
Regards,
Thank's matloud!!
Sorry for the stupid question... didn't find out a way to solve this. I'm using an external editor instead of ride7 so didn't notice the keywords.
Ipur
Would anybody happen to know why this doesn't compile? I used it on a PIC compiler before and was ok.
In the .h file:
typedef struct Calibrate_t
{
union
{
struct
{
uint8_t RunCurrent[2];
uint8_t StallCurrent[2];
uint8_t RunTime[2];
uint8_t RunTimeMax[2];
uint8_t StallTimeState[2];
uint8_t ReverseWhenStall;
uint8_t Spare1;
uint8_t Spare2;
};
uint8_t CalibrationArray[13];
};
}Calibrate_t;
extern Calibrate_t calibrate;
In the .c file
Calibrate_t calibrate;
The compiler error i am getting is:
*** ERROR C074 IN LINE 169 OF DATABASE.H : Invalid declaration syntax
*** ERROR C131 IN LINE 184 OF DATABASE.H : unbalanced #if-endif controls
I would like to be able to access the variables in main for example with the following syntax:
this is a different question, so we put it in a different topic:
http://forum.raisonance.com/viewtopic.php?pid=16261#p16261