| deadpickle (2) | ||||||
I'm sure this is an easy one to answer but I just cant see what the problem is. I get the error:
But the Node class is in the header btree.h, which is included in the above file.
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. | ||||||
|
Last edited on
|
||||||
| vlad from moscow (3662) | |
| Neither the compiler nor we know what is Node, because you included headers circularly inside each other. | |
|
Last edited on
|
|
| Peter87 (3917) | |
|
You have a circular dependency. 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. | |
|
Last edited on
|
|
| vlad from moscow (3662) | |
|
In header bree.h exclude statement #include "pq.h" and include statement class Event; Or create a third header that will contain class Event; class Head; | |
|
|
|
| ne555 (4386) | |
| ¿class Head? ¿why the namespace pollution? | |
|
|
|