Ho fatto un piccolo progetto.. un dizionario (la classe di base con solo l'interfaccia) in Dictionary.h implementato con albero RB (la classe derivata) in RB_Tree.h e gestione delle eccezioni del dizionario in Dictionary_Exception.h.
quando vado a fare make becco questi errori:
codice:
$ make myprog
g++ -O -g -Wall -I. -c -o main.o main.cpp
Dictionary_Exception.h:20: warning: 'class Dizionario_Exception' has virtual functions but non-virtual destructor
Dictionary_Exception.h:27: warning: 'class EmptyError' has virtual functions but non-virtual destructor
Dictionary.h: In instantiation of 'Dizionario<int, std::string>':
RB_Tree.h:19: instantiated from 'RB_Tree<int, std::string>'
main.cpp:18: instantiated from here
Dictionary.h:15: warning: 'class Dizionario<int, std::string>' has virtual functions but non-virtual destructor
RB_Tree.h: In instantiation of 'RB_Tree<int, std::string>':
main.cpp:18: instantiated from here
RB_Tree.h:19: warning: 'class RB_Tree<int, std::string>' has virtual functions but non-virtual destructor
Dictionary_Exception.h: In instantiation of 'SearchError<int>':
RB_Tree.h:384: instantiated from 'Data RB_Tree<Key, Data>::Search(Key) [with Key = int, Data = std::string]'
main.cpp:42: instantiated from here
Dictionary_Exception.h:37: warning: 'class SearchError<int>' has virtual functions but non-virtual destructor
Dictionary_Exception.h: In instantiation of 'RemoveError<int>':
RB_Tree.h:428: instantiated from 'void RB_Tree<Key, Data>::Remove(Key) [with Key = int, Data = std::string]'
main.cpp:42: instantiated from here
Dictionary_Exception.h:50: warning: 'class RemoveError<int>' has virtual functions but non-virtual destructor
g++ Dictionary.o Dictionary_Exception.o RB_Tree.o main.o -o myprog
i686-apple-darwin8-g++-4.0.1: Dictionary.o: No such file or directory
i686-apple-darwin8-g++-4.0.1: Dictionary_Exception.o: No such file or directory
i686-apple-darwin8-g++-4.0.1: RB_Tree.o: No such file or directory
make: *** [myprog] Error 1
Il mio make sarebbe questo:
codice:
CXXFLAGS= -O -g -Wall -I.
# la variabile CXXFLAGS contiene i vari flags (switches) usati dal
# compilatore C++
# -O attiva l'ottimizzatore (-O2, -O3, -O4 per ulteriori livelli di ottimizzazione)
# -g genera le informazioni di debug
# -Wall attiva la generazione di tutti i messaggi di "warning"
# -I. aggiunge la directory corrente (.) al percorso di ricerca per #include<>
# digitare man g++ per ulteriori informazioni
myprog: Dictionary.o Dictionary_Exception.o RB_Tree.o main.o
$(CXX) Dictionary.o Dictionary_Exception.o RB_Tree.o main.o -o myprog
main.o: Dictionary.h Dictionary_Exception.h RB_Tree.h
Dictionary.o: Dictionary.h
Dictionary_Exception.o: Dictionary_Exception.h
RB_Tree.o: RB_Tree.h
clean:
rm myprog *.o
qualcuno mi sa dire cosa c'è che non va?
Mi interessa prima di tutto compilarlo (quindi prima risolvere gli errori), dopo di che vorrei capire gli warning..