I am getting the following error msg and cant understand why
> Compiling MAIN.CPP:
> Error AVLTREE.H 24: Undefined structure 'Dictionary'
> Error AVLTREE.H 24: Size of 'info' is unknown or zero
> Error AVLTREE.H 24: Undefined structure 'Dictionary'
The declarations and includes for each class is as follows:
ontology.h
Code:
#include "diction.h"
class Ontology: public Dictionary
{
private:
MyString strObj;
AVLtree<MyString> treeObj;
void createOntologyTree ();
public:
Ontology () {strObj.ID=0;};
~Ontology (){infile.close(); outfile.close();};
void readXMLfile ();
};
diction.h
Code:
#include "generator.h"
class Dictionary :public Generator
{
protected:
MyString str;
AVLtree<Dictionary> avlObj;
void createOntologyDict (MyString str);
public:
int ID;
char key[MAX];
Dictionary () {ID=0;};
};
generator.h
Code:
#include "avltree.h"
#include "mystring.h"
#include "diction.h"
class Dictionary; //forward declaration
class Ontology; //forward declaration
class Generator: public AVLtree<MyString>, public AVLtree<Dictionary>
{
protected:
//.....
public:
ifstream infile;
ofstream outfile;
};
mystring.h
Code:
struct MyString
{
friend ostream& operator << (ostream& os, const MyString& obj);
int operator == (const MyString& obj) const;
int operator < (const MyString& obj) const;
int operator > (const MyString& obj) const;
char metaData[MAX];
char category[MAX];
char subCategory[MAX];
char keyWrd[MAX];
long ID;
};
avltree.h
Code:
template <class T>
struct AVLnode
{
friend class AVLtree<T>;
T info; <-- error points to here
int balance;
AVLnode<T> *right;
AVLnode<T> *left;
AVLnode () {right = left = NULL;}
};
//============================================
template <class T>
class AVLtree
{
public:
int count;
AVLnode<T> *tree, *walker;
AVLtree () {tree=walker=NULL; count=0;};
~AVLtree () {clear(tree);};
int insertData (const T &data);
void printAVLtree () {printInOrder(tree);};
protected:
void clear (AVLnode<T> *tree);
void insertHelper (AVLnode<T>* &root, AVLnode<T>*node, bool &higher);
void rightBalance (AVLnode<T> *&root, bool &higher);
void leftBalance (AVLnode<T> *&root, bool &higher);
AVLnode<T>* rotateRight (AVLnode<T> *root);
AVLnode<T>* rotateLeft (AVLnode<T> *root);
void printInOrder (AVLnode<T> *root);
};
I cant see what it is that I am missing or have done wrong...
Also...
Code:
AVLtree<MyString> <-- was working fine
AVLtree<Dictionary> <-- errors started occuring when I created this
Am I allowed to use both of these at the same time?
Sophie