I need to set up the following union type definition in a global header (.h) file
unsigned char App_Data_Type;
//Power on tests
unsigned char DPort_RAM_Fail_Flag :1;
unsigned char EEPROM_Fail_Flag :1;
unsigned char Watchdog_Fail_Flag :1;
unsigned char RAM_Fail_flag :1;
unsigned char Software_Build_Fail_Flag
unsigned char Backlight_Fail_Flag :1;
unsigned char Over_Temp_Fail_Flag :1;
unsigned char Spare_DV1 :1;
unsigned char Invalid_Message_Flag :1;
unsigned char Display_Blank_Flag :1;
unsigned char Temp_Sensor_Fail_Flag :1;
unsigned char Spare_DV2:3;
unsigned char CAN_Bus_Off_Flag :1;
unsigned char Rx_Timeout_Error_Flag:1;
unsigned char Segmentation_Error_Flag
unsigned char Spare_DV3 :5;
unsigned char Spare_DV4 :7;
//Range checking flags
unsigned char Spare_DV5 :6;
unsigned char Spare_DV6;
unsigned char Spare_DV7;
unsigned char bit_field_bytes;
However after declaring a variable instance
I get the compiler warning
"error C129 : missing ';' before 'Def_Var'"
Can any one tell me if the mistake is mine or the compilers please.
If the mistake is the compilers is there a workaround.
Thank you for your reply,
Yes I do feel a chump,
how ever that was a mistake in my email rather than the code. I am still having the same problem.
I did make that mistake.
I was the first time I used Unions, however I shouldn't have made this error as I use structures all the time.
Now that you've got it to compile, have you seen the following Keil knowledgebase articles for a couple of gotchas! with bitfields & unions:
GENERAL: UNION INVOLVING A BITFIELD IS THE WRONG SIZE
C51: BIT FIELD UNIONS DON'T WORK AS EXPECTED
View all questions in Keil forum