I'm implementing a WordInfo class that holds a word and the lines that the words appear in. But some reason I'm getting a LNK2019 Error when trying to build (I incrementally rebuild as I go to make sure it works).
#pragma once
#include <iostream>
#include <string>
#include "List.h"
#include "List.cpp"
namespace cs20
{
class WordInfo
{
public:
WordInfo();
WordInfo(std::string w);
WordInfo(std::string w, int l, bool duplicates = false);
bool addLine(int lineNo);
bool removeLine(int lineNo);
std::string getWord() const;
int getCount() const;
bool operator > (const WordInfo & ws) const;
bool operator < (const WordInfo & ws) const;
bool operator == (const WordInfo & ws) const;
private:
std::string word;
List<int> lines;
bool allowDuplicateLines;
};
}
#include "WordInfo.h"
namespace cs20
{
WordInfo::WordInfo()
{
}
WordInfo::WordInfo(std::string w)
:word(w)
{
}
WordInfo::WordInfo(std::string w, int l, bool duplicates)
: word(w), allowDuplicateLines(duplicates), lines()
{
//lines.insert(l);
}
bool WordInfo::addLine(int lineNo)
{
return false;
}
bool WordInfo::removeLine(int lineNo)
{
return false;
}
std::string WordInfo::getWord() const
{
return word;
}
int WordInfo::getCount() const
{
return 0;
}
bool WordInfo::operator>(const WordInfo & ws) const
{
return word > ws.word;
}
bool WordInfo::operator<(const WordInfo & ws) const
{
return word < ws.word;
}
bool WordInfo::operator==(const WordInfo & ws) const
{
return word == ws.word;
}
}
The error I'm getting is:
**1>WordInfo.obj : error LNK2019: unresolved external symbol "public: __thiscall cs20::ListNode<int>::ListNode<int>(int const &,class cs20::ListNode<int> *)" (??0?$ListNode@H@cs20@@QAE@ABHPAV01@@Z) referenced in function "public: __thiscall cs20::List<int>::List<int>(void)" (??0?$List@H@cs20@@QAE@XZ)**
And if I uncomment lines.insert(l), I'll get more errors:
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: __thiscall cs20::ListNode<int>::ListNode<int>(int const &,class cs20::ListNode<int> *)" (??0?$ListNode@H@cs20@@QAE@ABHPAV01@@Z) referenced in function "public: __thiscall cs20::List<int>::List<int>(void)" (??0?$List@H@cs20@@QAE@XZ)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: bool __thiscall cs20::ListNode<int>::nextIsNull(void)const " (?nextIsNull@?$ListNode@H@cs20@@QBE_NXZ) referenced in function "public: bool __thiscall cs20::List<int>::isEmpty(void)const " (?isEmpty@?$List@H@cs20@@QBE_NXZ)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: int const & __thiscall cs20::ListNode<int>::getElement(void)const " (?getElement@?$ListNode@H@cs20@@QBEABHXZ) referenced in function "public: class cs20::ListIterator<int> __thiscall cs20::List<int>::findPrevious(int const &)const " (?findPrevious@?$List@H@cs20@@QBE?AV?$ListIterator@H@2@ABH@Z)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: class cs20::ListNode<int> * __thiscall cs20::ListNode<int>::getNext(void)const " (?getNext@?$ListNode@H@cs20@@QBEPAV12@XZ) referenced in function "public: class cs20::ListIterator<int> __thiscall cs20::List<int>::findPrevious(int const &)const " (?findPrevious@?$List@H@cs20@@QBE?AV?$ListIterator@H@2@ABH@Z)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: void __thiscall cs20::ListNode<int>::setNext(class cs20::ListNode<int> *)" (?setNext@?$ListNode@H@cs20@@QAEXPAV12@@Z) referenced in function "public: void __thiscall cs20::List<int>::insert(int const &)" (?insert@?$List@H@cs20@@QAEXABH@Z)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: bool __thiscall cs20::ListIterator<int>::isValid(void)const " (?isValid@?$ListIterator@H@cs20@@QBE_NXZ) referenced in function "public: void __thiscall cs20::List<int>::remove(int const &)" (?remove@?$List@H@cs20@@QAEXABH@Z)
1>WordInfo.obj : error LNK2019: unresolved external symbol "public: int const & __thiscall cs20::ListIterator<int>::retrieve(void)const " (?retrieve@?$ListIterator@H@cs20@@QBEABHXZ) referenced in function "public: void __thiscall cs20::List<int>::makeEmpty(void)" (?makeEmpty@?$List@H@cs20@@QAEXXZ)
1>WordInfo.obj : error LNK2019: unresolved external symbol "private: __thiscall cs20::ListIterator<int>::ListIterator<int>(class cs20::ListNode<int> *)" (??0?$ListIterator@H@cs20@@AAE@PAV?$ListNode@H@1@@Z) referenced in function "public: class cs20::ListIterator<int> __thiscall cs20::List<int>::findPrevious(int const &)const " (?findPrevious@?$List@H@cs20@@QBE?AV?$ListIterator@H@2@ABH@Z)