Help please
I think my code is right but i get these errors in my client (int main) file
1>------ Build started: Project: ConsoleApplication60, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\jd\desktop\datastructures\dsprog4\dsprog4\main.cpp(1): warning C4067: unexpected tokens following preprocessor directive - expected a newline
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Book::Book(int)" (??0Book@@QAE@H@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Library::Library(void)" (??0Library@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Library::~Library(void)" (??1Library@@QAE@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: int __thiscall Book::getISBN(void)" (?getISBN@Book@@QAEHXZ) referenced in function "void __cdecl DeleteBookWorker(class Book *,class Book * &,int)" (?DeleteBookWorker@@YAXPAVBook@@AAPAV1@H@Z)
1>Source.obj : error LNK2019: unresolved external symbol "public: class Book * __thiscall Book::getNext(void)" (?getNext@Book@@QAEPAV1@XZ) referenced in function "int __cdecl CountBooksWorker(class Book *)" (?CountBooksWorker@@YAHPAVBook@@@Z)
1>c:\users\jd\documents\visual studio 2013\Projects\ConsoleApplication60\Debug\ConsoleApplication60.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
/**************************************************
HEADER FILE
**************************************************/
#include <iostream>
using namespace std;
//Book node
class Book
{
public:
Book(int s); //Constructor with a parameter "s" for isbn
int getISBN();
Book * getNext();
void setISBN(int s);
void setNext(Book * b);
private:
int isbn;
Book * next; //Pointer to next adjacent Book object
};
//Linked list declaration for class Library
class Library
{
public:
//Constructor
Library();
//Destructor
~Library();
//Search the book with isbn value contained in parameter "s"
//The function returns true if the book exists in the library, otherwise false
bool SearchBook(int s);
//Insert a Book object "b" into the library
void InsertBook(Book * bk);
//Delete the book with isbn of s.
//Assume the book to be deleted exists in the library.
void DeleteBook(int s);
//Print all books in the library from the first to the last.
void PrintLibrary();
//Print all books in the library in reverse order.
void RevPrintLibrary();
//Count the books in the library
int CountBooks();
private:
Book * first; //Pointer to the first book in the library
int length; //The number of books in the library
};
//Search a book starting from head
bool SearchBookWorker(Book * head, int s);
//Delete a book with isbn of s from a list starting from head and
//its upstream neighbor is prehead
void DeleteBookWorker(Book * prehead, Book * & head, int s);
//Print books in normal order
void PrintLibraryWorker(Book * head);
//Print books in reverse order
void RevPrintLibraryWorker(Book * head);
//Count books in a library
int CountBooksWorker(Book * head);
//Search a book starting from head
bool SearchBookWorker(Book * head, int s)
{
Book * temp = head->getNext();
if (head->getISBN() == NULL)
return false;
else
return SearchBookWorker(temp, s);
}
//Delete a book with isbn of s from a list starting from head and
//its upstream neighbor is prehead
void DeleteBookWorker(Book * prehead, Book * & head, int s)
{
if (s == head->getISBN())
{
prehead = head;
head->setNext(head->getNext());
delete prehead;
}
else
DeleteBookWorker(NULL, head, s);
/*
if (head == NULL)
cout << "List is empty." << endl;
else
{
prehead = head;
DeleteBookWorker(head->getNext(), s);
}
delete prehead;
*/
}
//Print books in normal order
void PrintLibraryWorker(Book * head)
{
if (head != NULL)
{
cout << head->getISBN() << endl;
PrintLibraryWorker(head->getNext());
}
}
//Print books in reverse order
void RevPrintLibraryWorker(Book * head)
{
if (head != NULL)
{
RevPrintLibraryWorker(head->getNext());
cout << head->getISBN();
}
}
//Count books in a library
int CountBooksWorker(Book * head)
{
if (head == NULL)
return 0;
else
return 1 + CountBooksWorker(head->getNext());
}
//The driver for PrintLibraryWorker
void Library::PrintLibrary()
{
PrintLibraryWorker(first);
}
//Print all books in the library in reverse order.
void Library::RevPrintLibrary()
{
RevPrintLibraryWorker(first);
}
//Count the books in the library
int Library::CountBooks()
{
return CountBooksWorker(first);
}
/**************************************************
CLIENT FILE
**************************************************/
#include "Header.h";
using namespace std;
int main()
{
Library lb;
Book * bk;
int isbn;
char command;
cout << "Input a command: 'S'(Search), 'I'(Insert), 'D'(Delete), 'P'(Print), 'Q'(Quit), 'R' (RevPrint), 'C' (Count)" << endl;
cin >> command;
while (command != 'Q')
{
switch (command)
{
case 'S':
cout << "Enter the ISBN number" << endl;
cin >> isbn;
lb.SearchBook(isbn);
break;
case 'I':
cout << "Enter the ISBN number" << endl;
cin >> isbn;
bk = new Book(isbn);
lb.InsertBook(bk);
break;
case 'D': // Delete
cout << " Entering the ISBN number" << endl;
cin >> isbn;
lb.DeleteBook(isbn);
break;
case 'P':
lb.PrintLibrary();
break;
case 'R':
lb.RevPrintLibrary();
break;
case 'C':
lb.CountBooks();
break;
default: // instructs user to quit program or insert valid command
cout << "Insert a valid command or press 'Q' to exit program ";
cin >> command;
break;
}
// prompts user to quite program or insert another command
cout << "Insert another command or press 'Q' to exit program ";
cin >> command;
}