解決済! 解決策の投稿を見る。
you are not going to beleive what the problem was. if you declare DATA after the structure you are using it in it doesn't compile and gives you all sort of errors but if you declare DATA before u use it in another data structure, it complies with no problem.
Thanks for your help
sincerely,
sorry that was a typo. i did use typedef in front of both structures.
thanks for the reply
Hello
This should work.
Which processor are you targeting (HC08, HC12, Coldfire, PowerPC, .....)?
Which version of CodeWarrior are you using?
To retrieve version information:
- Start IDE
- Select "Help" -> "About Metrowerks CodeWarrior" or "About Freescale CodeWarrior"
- Press the "Installed Products" button
- You will see the CodeWarrior version number on top of the "Installed product" dialog.
CrasyCat
hi
i am targetting freescale HC12(MC9S12D64) and the Code warrior version is 3.0 with IDE version number is 5.5.1272.
Could it be something in the compiler options that i need to look at???
thanks for replying
Hello
There should be something in your application.
I have created a project with CodeWarrior HC12 V3.0 and added following code there.
typedef struct{
int x;
int y;
}DATA;
typedef struct{
int j;
int k;
DATA d;
}STRUCT;
STRUCT myStruct;
void main(void) {
/* put your own code here */
EnableInterrupts;
myStruct.j= 9;
for(; {} /* wait forever */
}
I can build that without any problem.
You may have a syntax error right before the type definition for DATA. Anyway I would need to look at the preprocessor output of the file generating the message.
Can you generate that preprocessor listing (just add option -lp to your compiler command line. The compiler will generate a file with extension .pre. That is the file I need).
CrasyCat
you are not going to beleive what the problem was. if you declare DATA after the structure you are using it in it doesn't compile and gives you all sort of errors but if you declare DATA before u use it in another data structure, it complies with no problem.
Thanks for your help
sincerely,
Hello
This is compliant to ANSI C standard .
If type DATA is not known when STRUCT is defined, the compiler cannot evaluate the size of the type STRUCT. So it complains.
CrasyCat