Salve a tutti, nel mio programma vado a definire una variabile di tipo di una classe precedentemente definita in un file .h e ricevo l'errore del titolo.
Questo mi capita solo in un file (altri file sono compilati tranquillamente).
Vi incollo il codice:
codice:
lista.h:
#ifndef LISTA_H
#define LISTA_H
#include <iostream>
#include <fstream>
#include <string>
#include "tree.h"
template<class Value>
class Tree;
class LinkedList{
private:
struct nodolista{
char*Array;
nodolista*next;
static int size;
//costruttore
nodolista() {
next = 0;
Array = new char[size];
}
};
nodolista*head, *tail;
friend class Tree<char>;
public:
LinkedList();
LinkedList(int N);
void ListInsert(char el);
void ArrayInsert(char el, int i, nodolista*ptr);
void CopiaNodo(nodolista*ptr);
LinkedList(const LinkedList& rhs);
LinkedList& operator=(const LinkedList& rhs);
void deletelist();
~LinkedList();
void Stampa();
void ClearArray(nodolista*ptr);
};
#endif
tree.h
#include <iostream>
#include <fstream>
#include <string>
#include "lista.h"
template<class Value>
class Tree;
template<class Value>
class Node{
private:
Node * lchild; //puntatore alla lista dei figli
Node * rsibling; //puntatore al fratello destro
Node * lbrother; //puntatore al fratello sinistro
Node * father; //puntatore al padre
Value value;
// costruttore di default
Node(const Value&v) {
lchild = rsibling = father = lbrother = 0;
value = v;
}
//altro costruttore
Node(Node*lc, Node*rs, Node*lb, Node*f, const Value&v) {
lchild = lc;
rsibling = rs;
lbrother = lb;
father = f;
value = v;
}
friend class Tree<Value>;
};
template<class Value>
class Tree{
Node<Value> * root;
LinkedList * list; // riga dove viene dato l'errore
public:
// costruttore di default
Tree();
//altro costruttore
Tree(const Value& v);
// distruttore
~Tree();
void cancella(Node<Value> *nodo);
//costruttore di copia
Tree(const Tree& rhs);
Tree& operator=(const Tree& rhs);
Node<Value>* copia(Node<Value>* a);
Node<Value>* insert(Node<Value> * a, Node<Value> * b, Value valore);
Node<Value>* insertBrother(Node<Value> * a, Node<Value> * b, Value valore);
Node<Value>* SearchLenght(int wordlenght);
void VerificaSequenza(std::string sequenza);
void CreaNodoDimensione(std::string * V, int N);
void CreaNodoValore(Node<Value>*ptr, std::string stringa, int j);
void Ricerca(Node<Value>*ptr, std::string bit, int i, int maxLenght, LinkedList* list);
//attenzione alla separazione interfaccia-implementazione! I metodi pubblici non dovrebbero
//prendere o restituire puntatori => fai metodi privati e i corrispondenti metodi pubblici
};
#endif
Qualcuno sa aiutarmi? Grazie a chi mi risponderà!