S
softwareEngineer
Hi All,
I'm compiling this (external) code :
<CODE>
typedef struct _SIZE
{
int size_a;
int size_b;
}SIZE;
typedef struct _FOO
{
int a;
int b;
struct BAR
{
int x;
int y;
}BAR;
}FOO;
static SIZE mysize = { sizeof(struct BAR), sizeof(struct BAR) }; // <---- Error ...
int main (int argc, char *argv[])
{
printf(":: SERVER START :: \n");
printf ("SIZEOF BAR = %d \n", mysize.size_a);
printf(":: SERVER END :: \n");
return 0;
}
</CODE>
It gave this error :
--> server.c:25: error: invalid application of ‘sizeof’ to incomplete type ‘BAR’
Unique solution is to move "struct BAR" out from struct FOO ?
thank you
I'm compiling this (external) code :
<CODE>
typedef struct _SIZE
{
int size_a;
int size_b;
}SIZE;
typedef struct _FOO
{
int a;
int b;
struct BAR
{
int x;
int y;
}BAR;
}FOO;
static SIZE mysize = { sizeof(struct BAR), sizeof(struct BAR) }; // <---- Error ...
int main (int argc, char *argv[])
{
printf(":: SERVER START :: \n");
printf ("SIZEOF BAR = %d \n", mysize.size_a);
printf(":: SERVER END :: \n");
return 0;
}
</CODE>
It gave this error :
--> server.c:25: error: invalid application of ‘sizeof’ to incomplete type ‘BAR’
Unique solution is to move "struct BAR" out from struct FOO ?
thank you