error VC0000

Apr 10, 2016 at 12:55 PM
Edited Apr 10, 2016 at 12:56 PM
Please help me with these errors,
error VC0000: unions with primitive fields are not supported; either use _(backing_member) attribute or surround the offending field with 'struct { ... } _(myPrimitiveField);'

error VC0000: array fields directly in unions are not supported; surround the array with 'struct { ... } _(myArrayField);' or add _(as_array) attribute

I have a struct definition which has an array element of another struct.
struct foo{
     int elem;
     ...
} foo;

struct bar{
    foo elem2[16];   // above errors are arising at this line
} bar;
Thanking you.
Jul 20, 2016 at 11:21 AM
Edited Jul 20, 2016 at 11:21 AM
Sorry, wrong question.
Correct definitions:
struct foo{
     int elem;
     ...
} foo;

struct bar{
    struct foo elem2[16];   
} bar;
or
typedef struct foo{
     int elem;
     ...
} foo;

struct bar{
     foo elem2[16];  
} bar;
Marked as answer by bpankaj on 7/20/2016 at 4:25 AM
Developer
Jul 29, 2016 at 6:36 PM
Did you mean to have a union somewhere?