Hopefully this issue hasn't been posted multiple times in the past (apologies if it has).
I have found that if I declare a templated CLI class without instantiating it, I get linker errors:
template
<typename T >ref
struct MyTemplate{
~MyTemplate() { }
!MyTemplate() { }
};
int
main(array<System:: String ^> ^args){
MyTemplate<
int>^ xyz = nullptr; // remove any comment below and linker won't have an error // xyz = gcnew MyTemplate<int>(); // delete xyz; return 0;}
Has anyone else noticed this I was driving myself crazy looking for a fault in my code when there was none!!!
PS: The linker errors are:
error LNK2020: unresolved token (06000002) MyTemplate<int>:: Dispose
error LNK2020: unresolved token (06000003) MyTemplate<int>:: Dispose
error LNK2020: unresolved token (06000004) MyTemplate<int>:: Finalize