This question already has an answer here:
I have the following code:
template <class T>
BinaryHeap<T>::BinaryHeap(std::function<bool(T, T)> isHigherPriority)
{
m_isHigherPriority = isHigherPriority;
}
...
std::function<bool(int, int)> isHigherPriority = [](int a, int b) { return a <= b; };
BinaryHeap<int> heap(isHigherPriority);
The code seems to compile fine, but I get linker a linker error: LNK2019 unresolved external symbol "public: __thiscall BinaryHeap::BinaryHeap(class std::function)" (??0?$BinaryHeap@H@@QAE@V?$function@$$A6A_NHH@Z@std@@@Z)
Is there any reason why the linker would get confused?
Aucun commentaire:
Enregistrer un commentaire