I think you'll find that it doesn't work in C++ (but they might have changed the grammar rules so that it does). You probably mean something more like this:
struct Node {
event *thing;
Node *next;
};
That works in C++ because Node
is equivalent to struct Node
if there isn't already something called Node
(this sometimes causes puzzling errors when Foo
is both a class and the instance method of another class, which happens in some coding styles).
The fix is to say struct Node
. I prefer this; it seems more pure. There are some good reasons to use a typedef (e.g. things like TUInt64
which might have historically been a struct due to lack of compiler support). If you do use a typedef, there's no reason to give the struct a different name since they're in different namespaces (IIRC structs are a "tag namespace").
The usual typedef version is something like this:
typedef struct Node Node;
struct Node {
event *thing;
Node *next;
};
Alternatively, change the file extension to .mm and then it works because you're compiling Objective-C++!