0
我知道這個問題,當我聲明函數並沒有定義它時可能會發生。 但事實並非如此。未解析的外部符號。定義好吧
//In the 'H' file. Template class.
BSNode(T data);
\\In the cpp definitions
template <class T>
BSNode<T>::BSNode(T data)
{
_root = this;
_data = data;
_right = NULL;
_left = NULL;
}
而且還在,我得到了一個錯誤:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall BSNode<int>::BSNode<int>(int)" ([email protected]@@[email protected]@Z) referenced in function _main c:\Users\a\OneDrive\ss\visual studio 2013\Projects\Project5\2\Source.obj 2_TREES
什麼也可能會導致發生此錯誤,如果它不是「H」和「CPP」文件之間的不兼容?