UNIXのC++で「呼び出しに一致する関数がありません」というこのビルドエラーを解決するにはどうすればよいですか?
次のビルドエラーが発生します。
unixserver:Lab1> make
g++ -o LSL lab1.cpp Employee.cpp
lab1.cpp: In function int main():
lab1.cpp:199: error: no matching function for call to LinkedSortedList<Employee>::find(std::string&)
LinkedSortedList.cpp:137: note: candidates are: bool LinkedSortedList<Elem>::find(Elem) const [with Elem = Employee]
make: *** [main] Error 1
これが私の検索機能です:
// Check to see if "value" is in the list. If it is found in the list,
// return true, otherwise return false. Like print(), this function is
// declared with the "const" keyword, and so cannot change the contents
// of the list.
template<class Elem>
bool LinkedSortedList<Elem>::find(Elem searchvalue) const {
if (head == NULL) {
return false;
} else {
while (head != NULL) {
LinkedNode<Elem>* pointer;
for (pointer = head; pointer != NULL; pointer = pointer->next)
if (pointer->value == searchvalue) {
return true;
}
}
}
return false;
}
そして、これは「public:」セクションの下のLinkedSortedList.hファイルにあります。
bool find(Elem searchvalue) const;
欠落しているコードは次のとおりです。199行目
case 'S':
cout << "Save database to a file selected\n\n";
// TODO call function to save database to file
// File I/O Save to file
cout << "Please enter a file name: " << endl;
cin >> fileName;
{char* file = (char*) fileName.c_str();
writeFile(file, database);}
break;