I am having this error message whenever I tried to compile
Error 6 error LNK2019: unresolved external symbol "void __cdecl MergeSort(class LinkedList<int> &)" (?MergeSort@@YAXAAV?$LinkedList@H@@@Z) referenced in function _main C:\Users\FOla Yinka\Documents\Visual Studio 2012\Projects\C++\C++\linkedlist.obj C++
Error 7 error LNK1120: 1 unresolved externals C:\Users\FOla Yinka\Documents\Visual Studio 2012\Projects\C++\Debug\C++.exe 1 1 C++
I have this in my header file
template<typename T>
class LinkedList{
protected:
public:
friend void MergeSort(LinkedList<T> &list);
};
template<typename T>
void MergeSort(LinkedList<T> &list){
}
To check if the fault is in the function declaration, I turned all the protected
members public
and I removed the friendship so MergeSort
can have access to all memebers and then the program compiled successfully. I don't know why I am having this error message.