perhaps this can be a very popular error, but i´m beginner and i not used to see problems like this
erros list:Code:#include <stdio.h> #include <tchar.h> #include <iostream> #include <string> #include <fstream>// enable writing to and reading from files #include <cstdlib> #include <time.h> using namespace std; class Person { public: //Constructor and Destructor Methods Person(){cout<<"\n\tBuilding a Person.";}; ~Person(){cout<<"\n\tDestroying a Person.";}; //Accessor Methods string getName (){ return Name; } string getLocation (){ return Location; } string getAge (){ return Age; } string getOccupation (){ return Occupation; } void setName (string Name) { Name = Name; } void setLocation (string Location) { Location = Location; } void setAge (string Age) { Age = Age; } void setOccupation (string Occupation) { Occupation = Occupation; } private: string Name, Location, Age, Occupation; }; //Function prototypes void createperson(); void editperson(); void displayperson(); void saveperson(); void loadperson(); int main (int argc, char *argv[]) { Person* cg = new Person(); char choose[10] = ""; cout<<"\n\t Personnel database 1.0\n"; //system display ("CLS"); while (choose [0] != 'q') { system ("CLS"); cout<<"\n\t---------------------Main Menu---------------------\n"; cout<<"\n\t| |\n"; cout<<"\n\t| (c) Create person |\n"; cout<<"\n\t| (E) edit information |\n"; cout<<"\n\t| (D) display person |\n"; cout<<"\n\t| (S) Save person |\n"; cout<<"\n\t| (L) Load person |\n"; cout<<"\n\t| (Q) quit |\n"; cout<<"\n\t| |\n"; cout<<"\n\t---------------------------------------------------\n\n\t"; cin>>choose; //system ("CLS"); switch (choose [0]) { //system ("CLS"); case 'c': createperson(); break; case 'e': editperson(); break; case 'd': displayperson(); system ("pause"); break; case 's': saveperson(); break; case 'l': loadperson(); break; case 'q': cout<<"\n\tExiting main menu..."; break; default :"\n\tInvalid input!"; } } system ("pause"); return 0; } //Function´s scope void createperson() { Person* cg = new Person(); } void editPerson() { Person* cg = new Person(); string TEMP; system ("CLS"); cout<<"\n\n\t---------------------EDIT person ---------------------------"; cout<<"\n\t Name: "; getline (cin,TEMP); cg->setName(TEMP); cout<<"\n\t Location "; getline (cin,TEMP); cg->setLocation(TEMP); cout<<"\n\t Age: "; getline (cin,TEMP); cg->setAge(TEMP); cout<<"\n\t Occupation: "; getline (cin,TEMP); cg->setOccupation(TEMP); } void displayPerson() { Person* cg = new Person(); system("CLS"); cout<<"\n\n\t---------------------person information----------------------"; cout<< "\n\tName: " , cg-> getName(); cout<< "\n\tOccupation:" , cg-> getLocation(); cout<< "\n\tLocation: " , cg-> getAge(); cout<< "\n\tReferences:" , cg-> getOccupation(); cout<<"\n\n\t---------------------------------------------------------------\n\n"; } void savePerson() { Person* cg = new Person(); try { ofstream DATAFILE; DATAFILE.open("Data1.file",ios::out); DATAFILE <<cg->getName ()<<"\n"; DATAFILE <<cg->getLocation ()<<"\n"; DATAFILE <<cg->getAge ()<<"\n"; DATAFILE <<cg->getOccupation ()<<"\n"; DATAFILE.close(); //Prevents data from getting corrupt incase of sudden shutdown cout<<"\n\t Success! Data was saved to file."; } catch (exception x) { cout<<"\n\t File Error! Could not SAVE PERSON."; } } void loadperson() { Person* cg = new Person(); try { string TEMP; ifstream DATAFILE; DATAFILE.open("Data1.file",ios::in); getline (DATAFILE,TEMP); cg->setName (TEMP); getline (DATAFILE,TEMP); cg->setLocation (TEMP); getline (DATAFILE,TEMP); cg->setAge (TEMP); getline (DATAFILE,TEMP); cg->setOccupation (TEMP); DATAFILE.close(); } catch (exception x) { cout<<"\n\t File Error! Unable to load data."; } }
what i can do to fit this problem?Code:Error 1 error LNK2019: unresolved external symbol "void __cdecl saveperson(void)" (?saveperson@@YAXXZ) referenced in function _main H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj Error 2 error LNK2019: unresolved external symbol "void __cdecl displayperson(void)" (?displayperson@@YAXXZ) referenced in function _main H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj Error 3 error LNK2019: unresolved external symbol "void __cdecl editperson(void)" (?editperson@@YAXXZ) referenced in function _main H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj Error 4 error LNK1120: 3 unresolved externals H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Debug\Using_class_ in_ c++.exe 1




Reply With Quote