initializer for struct with anonymous union.
Danni Coy
danni.coy at gmail.com
Sat Apr 11 06:39:23 UTC 2026
On Sat, Apr 11, 2026 at 4:18 PM Danni Coy <danni.coy at gmail.com> wrote:
> I currently have a linker error telling me
>
> undefined reference to `initializer for event.Event`
>
> Event is a struct with a union. Something Like
>
> struct Event
> {
> EventType type;
> union
> {
> EventA a;
> EventB b;
> }
> }
>
> Naming the union makes the linker errors go away.
> Can anybody tell me what is going on here?
>
ok with further investigation, linker errors come back as soon as I add the
union into the struct.
eg
union u
{...
...}
u event;
}
why would my struct now no longer have an initializer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20260411/1465ecaf/attachment.htm>
More information about the Digitalmars-d-learn
mailing list