Programming Assignment Error I am suppose to be able to crea
Programming Assignment Error
I am suppose to be able to create a list of customer stores for each employee in the database.
However, I have followed most of the requirements but I am having an issue with the code from the CustomerList.cpp file.
I am getting Code Error: LNK2019 from Visual Studios 2015
 
 Some errors:
 
 1.) Error   LNK2019   unresolved external symbol \"public: __thiscall Store::Store(int,char *,char *,char *,char *,char *)\" (??0Store@@QAE@HPAD0000@Z) referenced in function \"public: bool __thiscall CustomerList::addStore(class Store *)\" (?addStore@CustomerList@@QAE_NPAVStore@@@Z)   
2.) Error LNK2001 unresolved external symbol \"public: __thiscall Store::Store(int,char *,char *,char *,char *,char *)\" (??0Store@@QAE@HPAD0000@Z)
3.) Error LNK2019 unresolved external symbol \"public: int __thiscall Store::getStoreID(void)\" (?getStoreID@Store@@QAEHXZ) referenced in function \"public: bool __thiscall CustomerList::addStore(class Store *)\" (?addStore@CustomerList@@QAE_NPAVStore@@@Z)
4. Error LNK2019 unresolved external symbol \"public: char * __thiscall Store::getStoreName(void)\" (?getStoreName@Store@@QAEPADXZ) referenced in function \"public: bool __thiscall CustomerList::addStore(class Store *)\" (?addStore@CustomerList@@QAE_NPAVStore@@@Z)
5.) Error LNK2019 unresolved external symbol \"public: char * __thiscall Store::getStoreAddress(void)\" (?getStoreAddress@Store@@QAEPADXZ) referenced in function \"public: bool __thiscall CustomerList::addStore(class Store *)\" (?addStore@CustomerList@@QAE_NPAVStore@@@Z)
CustomerList.cpp
#include
 #include \"CustomerList.h\"
 #include \"Store.h\"
 using namespace std;
 CustomerList::CustomerList()
 {
    m_pHead = NULL;
    // Default constructor
 }
 CustomerList::~CustomerList()
 {
    delete m_pHead;
    // Destructor
 }
//THE ERRORS STARTS FROM HERE. WHEN I COMMENT OUT ALL LINES FROM THIS FILE ONLY BEGINNING HERE AND BELOW THE ERRORS GO AWAY. ERRORS PROVIDED ON PICTURE.
bool CustomerList::addStore(Store *s)
 {
    //creating a new instance
    if (m_pHead == NULL)
    {
        m_pHead = new Store(s->getStoreID(), s->getStoreName(), s->getStoreAddress(), s->getStoreCity(), s->getStoreState(), s->getStoreZip());
        return true;
    }
    else
    {
        Store *temp;
        temp = m_pHead;
        while (temp->m_pNext != NULL)
        {
            temp = temp->m_pNext;
        }
        temp->m_pNext = new Store(s->getStoreID(), s->getStoreName(), s->getStoreAddress(), s->getStoreCity(), s->getStoreState(), s->getStoreZip());
        return true;
    }
 }
 Store *CustomerList::removeStore(int ID)
 {
    Store *temp, *back;
    temp = m_pHead;
    back = NULL;
    while ((temp != NULL) && (ID != temp->getStoreID()))
    {
        back = temp;
        temp = temp->m_pNext;
    }
    if (temp == NULL)
        return NULL;
    else if (back == NULL)
    {
        m_pHead = m_pHead->m_pNext;
        return temp;
    }
    else
    {
        back->m_pNext = temp->m_pNext;
        return temp;
    }
    return NULL;
 }
 Store *CustomerList::getStore(int ID)
 {
    Store *temp;
    temp = m_pHead;
    while ((temp != NULL) && (ID != temp->getStoreID()))
    {
        temp = temp->m_pNext;
    }
    if (temp == NULL)
        return NULL;
    else
    {
        Store *retStore = new Store;
        *retStore = *temp;
        retStore->m_pNext = NULL;
        return retStore;
    }
 }
 bool CustomerList::updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip)
 {
    return false;
 }
 void CustomerList::printStoresInfo()
 {
    Store *temp;
    cout << \" ===================================================================================== \" << endl;
    if (m_pHead == NULL)
    {
        cout << \" The List is currently empty.\ \";
    }
    else
    {
        temp = m_pHead;
        while (temp != NULL)
        {
            temp->printStoreInfo();
            temp = temp->m_pNext;
        }
    }
 }
CustomerList.h
#pragma once
 #include
 #include \"Store.h\"
class CustomerList
 {
public:
    Store *m_pHead;
    CustomerList();
    ~CustomerList();
    bool addStore(Store *s);
    Store *removeStore(int ID);
    Store *getStore(int ID);
    bool updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip);
    void printStoresInfo();
};
Store.cpp
#pragma once
 #include \"Store.h\"
 #include
using namespace std;
Store::Store()
 {
    m_pNext = NULL;
 }
 Store::Store(int ID, char *name, char *addr, char *city, char *st, char *zip)
 {
    m_iStoreID = ID;
    strcpy(m_sStoreName, name);
    strcpy(m_sAddress, addr);
    strcpy(m_sCity, city);
    strcpy(m_sState, st);
    strcpy(m_sZip, zip);
    m_pNext = NULL;
 }
 Store::~Store()
 {
    // Nothing to do here
 }
int Store::getStoreID()
 {
    return m_iStoreID;
 }
 void Store::setStoreID(int ID)
 {
    m_iStoreID = ID;
 }
 char *Store::getStoreName()
 {
    char *name = new char[strlen(m_sStoreName) + 1];
    strcpy(name, m_sStoreName);
    return name;
 }
 void Store::setStoreName(char *name)
 {
    strcpy(m_sStoreName, name);
 }
 char *Store::getStoreAddress()
 {
    char *addr = new char[strlen(m_sAddress) + 1];
    strcpy(addr, m_sAddress);
    return addr;
 }
 void Store::setStoreAddress(char *addr)
 {
    strcpy(m_sAddress, addr);
 }
 char *Store::getStoreCity()
 {
    char *city = new char[strlen(m_sCity) + 1];
    strcpy(city, m_sCity);
    return city;
 }
 void Store::setStoreCity(char *city)
 {
    strcpy(m_sCity, city);
 }
 char *Store::getStoreState()
 {
    char *state = new char[strlen(m_sState) + 1];
    strcpy(state, m_sState);
    return state;
 }
 void Store::setStoreState(char *state)
 {
    strcpy(m_sState, state);
 }
 char *Store::getStoreZip()
 {
    char *zip = new char[strlen(m_sZip) + 1];
    strcpy(zip, m_sZip);
    return zip;
 }
 void Store::setStoreZip(char *zip)
 {
    strcpy(m_sZip, zip);
 }
 void Store::printStoreInfo()
 {
    cout << m_iStoreID << setw(20) << m_sStoreName << setw(15) << m_sAddress
        << setw(15) << m_sCity << \", \" << m_sState << setw(10) << m_sZip << \"\ \";
 }
Store.h
#pragma once
 #include
using namespace std;
class Store
 {
 private:
    int       m_iStoreID;
    char   m_sStoreName[64];
    char   m_sAddress[64];
    char   m_sCity[32];
    char   m_sState[32];
    char   m_sZip[11];
public:
    Store   *m_pNext;
   Store();                       // Default constructor
    Store(int ID,                   // Constructor
        char *name,
        char *addr,
        char *city,
        char *st,
        char *zip);
    ~Store();                       // Destructor
    int getStoreID();               // Get/Set store ID
    void setStoreID(int ID);
    char *getStoreName();           // Get/Set store name
    void setStoreName(char *name);
    char *getStoreAddress();       // Get/Set store address
    void setStoreAddress(char *addr);
    char *getStoreCity();           // Get/Set store city
    void setStoreCity(char *city);
    char *getStoreState();           // Get/Set store state
    void setStoreState(char *state);
    char *getStoreZip();           // Get/Set store zip code
    void setStoreZip(char *zip);
    void printStoreInfo();           // Print all info on this store
 };
EmployeeRecord.h
#pragma once
 #include \"CustomerList.h\"
class EmployeeRecord
 {
 private:
    int m_iEmployeeID;
    char m_sFirstName[32];
    char m_sLastName[32];  
    int m_iDeptID;
    double m_dSalary;  
public:
    CustomerList *getCustomerList();
    CustomerList *m_pCustomerList;
   EmployeeRecord(); //Constructor
    EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal); //Setting the values.
    ~EmployeeRecord(); //Destructor
   int getID(); // Return the value stored in the member variable
    void setID(int ID);
    void getName(char *fName, char *lName);
    void setName(char *fName, char *lName);
    int getDept();
    void setDept(int d);
    double getSalary();//Define Pointer Function
    void setSalary(double sal);//Copy the function argument to m_dSalary.
    void printRecord(); //Print to screen
};
EmployeeRecord.cpp
#include
 #include \"EmployeeRecord.h\"
 #include
 #include
using namespace std;
EmployeeRecord::EmployeeRecord()
 {
   //Set Values
    m_iEmployeeID = 0;
    m_sFirstName[0] = \'\\0\';
    m_sLastName[0] = \'\\0\';
    m_iDeptID = 0;
    m_dSalary = 0.0;
 }
 EmployeeRecord::EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal)
 {
    //Problem 1
    m_iEmployeeID = ID;
    strcpy(m_sFirstName, fName);
    strcpy(m_sLastName, lName);
    m_iDeptID = dept;
    m_dSalary = sal;
 }
//Destructor
EmployeeRecord::~EmployeeRecord()
 {
}
int EmployeeRecord::getID()
 {
    return m_iEmployeeID;
 }
void EmployeeRecord::setID(int ID)
 {
    m_iEmployeeID = ID;
 }
void EmployeeRecord::getName(char *fName, char *lName)
 {
    //Problem 2
    strcpy(fName, m_sFirstName);
    strcpy(lName, m_sLastName);
 }
void EmployeeRecord::setName(char *fName, char *lName)
 {
   strcpy(m_sFirstName, fName);
    strcpy(m_sLastName, lName);
}
 int EmployeeRecord::getDept()
 {
    return m_iDeptID;
 }
void EmployeeRecord::setDept(int d)
 {
    m_iDeptID = d;
 }
double EmployeeRecord::getSalary()
 {
   return m_dSalary;
 }
void EmployeeRecord::setSalary(double sal)
 {
    m_dSalary = sal;
 }
void EmployeeRecord::printRecord()
 {
    cout << \"ID: \" << m_iEmployeeID << endl;
    cout << \"First Name: \" << m_sFirstName << endl;
    cout << \"Last Name: \" << m_sLastName << endl;
    cout << \"Department: \" << m_iDeptID << endl;
    cout << \"Salary: \" << m_dSalary << endl;
 }
CustomerList *EmployeeRecord::getCustomerList()
 {
    return m_pCustomerList;
 }
int main(void)
 {
    int ID;
    char firstname[32] = \"\";
    char lastname[32] = \"\";
    int dept;
    double sal;
    cout << \"Enter Employee ID: \";
    cin >> ID;
    cout << \"Enter your First Name: \";
    cin >> firstname;
    cout << \"Enter your last name: \";
    cin >> lastname;
    cout << \"Enter Department: \";
    cin >> dept;
    cout << \"Enter Salary: \";
    cin >> sal;
   EmployeeRecord *Employee = new EmployeeRecord(ID, firstname, lastname, dept, sal);
    Employee->printRecord();
   Employee->setID(2);
    char* firstName = \"John\";
    char* lastName = \"Doe\";
    Employee->setName(firstName, lastName);
    Employee->setDept(2);
    Employee->setSalary(4000);
   cout << \"--------------------------------\" << endl;
    Employee->printRecord();
    system(\"pause\");   
CustomerList *cl = Employee->getCustomerList();
    Store *s = new Store(2505, \"Best Buy\", \"1231 Main St.\", \"Birmingham\", \"Alabama\", \"12345\");
    cl->addStore(s);
    cl->printStoresInfo();
    return 0;
 }
Solution
The following statement is needed to be added :
#include \"Store.cpp\" in CustomerList.cpp
to get the definitions of the methods being used in addStore function because from Store.h we get only the declarations and not the definitions.









