First, here is the code:
Main.CPPPBClass.hCode:#include <cstdlib> #include <iostream> #include <string> #include <vector> #include <algorithm> #include "PBClass.h" using namespace std; PhoneBook::PhoneBook* PB = new PhoneBook::PhoneBook::PhoneBook(); int main(int argc, char *argv[]) { PB->AddPerson(); system("PAUSE"); return EXIT_SUCCESS; }PBFunctions.CPPCode:#include <cstdlib> #include <iostream> #include <string> #include <vector> #include <algorithm> using std::string; namespace PhoneBook { class PhoneBook { private: struct person { int number; string f_name; string l_name; }; std::vector<person> PVec; public: PhoneBook(); ~PhoneBook(); void AddPerson(person *pb); void AddPerson(); //void RemovePerson(person *pb); }; }Now here is the problem: it won't compile. Everytime I try I get this error:Code:#include <cstdlib> #include <iostream> #include <string> #include <vector> #include <algorithm> #include "PBClass.h" using namespace std; namespace PhoneBook { void PhoneBook::AddPerson(PhoneBook::person *pb) { PVec.push_back(*pb); } void PhoneBook::AddPerson() { person *npb; cout<<"Please put in the phone number of the person:\n"; cin>>npb->number; cout<<"\nPlease input the first name of the person:\n"; cin>>npb->f_name; cout<<"\nPlease input the last name of the person:\n"; cin>>npb->l_name; cout<<endl; PVec.push_back(*npb); //cout<<PVec.end(); } }
[Linker error] undefined reference to `PhoneBook::PhoneBook::PhoneBook()'
and to be perfectly honest, I'm lost as to what to do.
As always, any help would be appreciated.



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.