 | Discussion Forum |  |
|
|
Problem with structures containing structuresNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Roger Ludwig Posted 14-Aug-2001 18:35 GMT Toolset C51 |  Problem with structures containing structures Roger Ludwig Hello,
I have a problem with the following structure declaration:
typedef struct { HDEntriesTYPE HDWindowStartSTRUCT; } actualPlayerStatusTYPE;
typedef struct { unsigned long StartClusterUL; unsigned long FileSizeUL; unsigned char FileNameUC[HD_MAX_NAME_LENGTH]; // 40 Characters + ".mp3" + \0 } HDEntriesTYPE;
This should generate a type structure named "actualPlayerStatusTYPE" which contains a structure "HDWindowStartSTRUCT" of the type HDEntriesTYPE. But when I compile the above declarations I get two compiler error messages: C141: syntax error near 'HDEntriesTYPE' and C129: missing ';' before HDWindowStartSTRUCT
I don't no where is the problem. Can anybody give me a hint?!
Thanks.
RoGeR | | Read-Only Author tom mazowiesky Posted 14-Aug-2001 18:44 GMT Toolset C51 |  RE: Problem with structures containing structures tom mazowiesky The only thing wrong is that the order is reversed. The declaration of HDEntriesType must preceed its use, thus:
typedef struct
{
unsigned long StartClusterUL;
unsigned long FileSizeUL;
unsigned char FileNameUC[HD_MAX_NAME_LENGTH]; // 40 Characters + ".mp3" + \0
} HDEntriesTYPE;
typedef struct
{
HDEntriesTYPE HDWindowStartSTRUCT;
} actualPlayerStatusTYPE;
This will compile correctly.
| | Read-Only Author Roger Ludwig Posted 14-Aug-2001 21:19 GMT Toolset C51 |  RE: Problem with structures containing structures Roger Ludwig I'm such a ...!!! Of course you're right! Thank's a lot.
RoGeR | | Read-Only Author tom mazowiesky Posted 14-Aug-2001 21:48 GMT Toolset C51 |  RE: Problem with structures containing structures tom mazowiesky No problem - we all end up there once in a while! | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|