hi again
here is a trouble that I used to skip... now that came the time to solve it, I couldn't find the solution:
avl_tree.h
Code:
#ifndef AVL_TREE_H
#define AVL_TREE_H
template <class T>
class avl {
public:
avl ();
~avl ();
};
#ENDIF
avl_tree.cpp
Code:
#include "avl_tree.h"
template <class T> avl<T>::avl() {}
template <class T> avl<T>::~avl() {}
My "main.cpp" program will #include "avl_tree.h".
If I compile "main.cpp" and "avl.cpp" and link them together, it's all ok.
But if I main.cpp contains an instantiation
I get from the linker:
g++ -O0 -g3 -o test main.o avl_tree.o
main.o: In function `__tcf_1':/home/.../src/main.cpp:11: undefined reference to `avl<int>::~avl()'
main.o: In function `__static_initialization_and_destruction_0':/home/...main.cpp:11: undefined reference to `avl<int>::
what am i missing?