I am trying to represent a map using nodes. This code segment seems to work just fine in C, but craps out in C++.
struct node{
char name[50];
struct node* neighbors[6];
};
struct node one;
struct node two;
struct node three;
struct node one={"one",
{&two, &three}
};
struct node two={"two",
{&one, &three}
};
struct node three={"three",
{&two, &one}
};
--------------------------
My problem is that when I try to do this in C++, I get complaints of redefinitions. If I don't do the forward declaration, then I get unknown object errors.
I'm fundamentally missing something, I'm sure.
-lloopy
struct node{
char name[50];
struct node* neighbors[6];
};
struct node one;
struct node two;
struct node three;
struct node one={"one",
{&two, &three}
};
struct node two={"two",
{&one, &three}
};
struct node three={"three",
{&two, &one}
};
--------------------------
My problem is that when I try to do this in C++, I get complaints of redefinitions. If I don't do the forward declaration, then I get unknown object errors.
I'm fundamentally missing something, I'm sure.
-lloopy
Comment