btw. here's the implementation:
#include "Y.h"
template<class X> Y<X>::~Y()
{
delete Something;
}
#include "Y.h"
template<class X> Y<X>::~Y()
{
delete Something;
}
To copy to clipboard, switch view to plain text mode
It's defined in Y.cpp.
If I put this code inside the header file Y.h, there are no problems. If I leave the code here, I get
release/Z.o:Z.cpp::-1: error: undefined reference to `Y<_mytype>::~Y()'
release/Z.o:Z.cpp::-1: error: undefined reference to `Y<_mytype>::~Y()'
To copy to clipboard, switch view to plain text mode
. Z.cpp includes Y.h.
Bookmarks