following this link
I did:
static const struct attribute const *attrs1= {
&foo_attribute.attr,
NULL,
};
static const struct attribute_group const attr_group = {
.attrs = attrs1,
};
but get these errors:
error: initializer element is not constant
error: (near initialization for 'attr_group.attrs')
found this solution but didn’t understand how to solve it…
EDIT:
the line triggered the error:
.attrs = attrs1,
Yes, another
structobject or the contents of another variable will never be considered a constant expression that could be used in an initializer for astaticobject.But your first initialization also is bogus. Probably you meant
So your initialization of the second would read something like