Originally Posted by
iMalc
C2437 is shown here:
Compiler Error C2437
It means that you are initialising LBTree (the base class) twice. The code you've posted does not demonstrate that so I'm 99.9% sure that your real code has other stuff in it which is the real cause of the problem. Afterall, if your constructor were really exactly as you posted then it is the same as the default constructor, in which case you should delete it and this would logically have to cause the same fault, which is impossible.
Post the entire unedited constructor for SearchTree.
That is actually the whole constructor for SearchTree.
LBTree is actually a typedef of a templated LBT class as follows:
Code:
typedef LinkedBinaryTree<LBTEntry> LBTree;
with
Code:
template <typename Key, typename Element,
typename LBTEntry = Entry<Key, Element> >
on top of SearchTree.h.
LinkedBinaryTree's constructor is as follows:
Code:
LinkedBinaryTree() : _root(new Node), nodes(1) { }
I also find it strange that the compiler wasn't reporting the error when the main function was commented out. I think I need to modify
Code:
SearchTree <int, CityRecord> stree;
to include the Entry class. I tried
Code:
SearchTree <Entry <int, CityRecord> > stree;
but I get a too few arguments error, which makes sense, but I dont understand what additional argument I have to add since I only need the key and the CityRecord object.
The errors after the above modification are:
Code:
error C2976: 'SearchTree' : too few template arguments
error C2133: 'stree' : unknown size
error C2512: 'SearchTree' : no appropriate default constructor available
Note: The SearchTree constructor I provided above is instructor supplied