Forum : ST7/STM8
Post Information | Post |
---|---|
August 13, 2014 - 2:24pm
|
(moved from here: http://forum.raisonance.com/viewtopic.php?pid=16262#p16262) 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 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 I would like to be able to access the variables in main for example with the following syntax: |
Hello,
The first error comes because at the time the structure is compiled, the uint8_t is not (yet) defined.
Please check your includes. You should have a .h file that defines uint8_t and others. Check that you have it and that you include it before defining this struct.
The second error means that you have a #if without a #endif or the opposite. It comes from code that does not appear in your extract so we cannot tell you more. But you must correct it before going further, because it could be the cause of the first error, or it could have the same cause.
If this does not help, we will need a complete project, including source files, headers, etc. for helping you more.
Best Regards,
Raisonance support
Hi Etienne,
Thanks for getting back to me. I'll remember to put all different posts on a new topic in future :p
I changed all of the "uint8_t" to "unsigned char" and I am still getting same compiler errors.
Also if I comment out the struct decleration in the .c and .h it compiles fine, so I think i have got my #if & #endif correctly bounded.
Can I send a zipped up package of my project to "etienne.cassin@raisonance.com" ?
typedef struct
{
union
{
struct
{
unsigned char RunCurrent[2];
unsigned char StallCurrent[2];
unsigned char RunTime[2];
unsigned char RunTimeMax[2];
unsigned char StallTimeState[2];
unsigned char ReverseWhenStall;
unsigned char Spare1;
unsigned char Spare2;
};
unsigned char CalibrationArray[13];
};
}Calibrate_t;
extern Calibrate_t calibrate;
Hello,
Please, send your project to .
Best regards,