#ifndef PQ_H
#define PQ_H
#include "voronoi.h"
#include "btree.h"
//main class for events
class Event {
public:
std::string type;
Point coord;
Node *arc1;
Node *arc2;
Node *arc3;
};
//create a PointEvent
Event PointEvent(Point mycoord);
Event CircleEvent(Node *arc1, Node *arc2, Node *arc3);
#endif
But the Node class is in the header btree.h, which is included in the above file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef BTREE_H
#define BTREE_H
#include "voronoi.h"
#include "pq.h"
#include <vector>
//Node class: leaves of binary tree
class Node {
public:
Node();
Node(Point site);
Point point;
Node *left;
Node *right;
Event *cevent;
};
...
Here is the notable part of the btree.h file. If I comment out the Node declarations I get an error for the Event class, which is vise versa. I'm not sure what I'm missing so before I hulk out and smash things it would be good to get a fresh pair of eyes to see if im missing something. Thanks.
btree.h includes pq.h. pq.h includes btree.h but no code is included because of the header guard so Node has not yet been defined when Event is defined. The solution is to do forward declaration class Node;
in pq.h instead of including btree.h. In pq.cpp you can include btree.h if you have to.