1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Error 1 error LNK2019: unresolved external symbol "void __cdecl Fill_vector(class std::vector<class LandDetails,class std::allocator<class LandDetails> > &)" (?Fill_vector@@YAXAAV?$vector@VLandDetails@@V?$allocator@VLandDetails@@@std@@@std@@@Z) referenced in function _main
//here, i had written a vector and initialized with a class object containing strings like this:
LandDetails obj (string1, string2, string3....); //LandDetails is a class containing declared string variables: string string1, string2, string3...;
myVector.push_back (obj); //is there anything wrong here ?
Error 2 error LNK2019: unresolved external symbol "void __cdecl Display_vector(class std::vector<class LandDetails,class std::allocator<class LandDetails> > const &)" (?Display_vector@@YAXABV?$vector@VLandDetails@@V?$allocator@VLandDetails@@@std@@@std@@@Z) referenced in function _main
//here, i wanted to display the contents of the vector filled above like this:
void Display_vector (const vector <LandDetails>& displayer){
cout<<"You have entered :\n\n";
cout<<"string1: "<<displayer[i].string1<<"\n";
cout<<"string1: "<<displayer[i].string2<<"\n";
cout<<"string1: "<<displayer[i].string3<<"\n";
}
Error 3 error LNK2019: unresolved external symbol "void __cdecl write_vector(class std::vector<class LandDetails,class std::allocator<class LandDetails> > &)" (?write_vector@@YAXAAV?$vector@VLandDetails@@V?$allocator@VLandDetails@@@std@@@std@@@Z) referenced in function _main
//here, i wanted to write the contents of the vector filled to file like this:
void write_vector (const vector <LandDetails>& writeFile){
std::ofstream outFile("File.txt", ios::app);
outFile<<"string1: "<<writeFile [i].string1<<",";
outFile<<"string1: "<<writeFile [i].string2<<",";
outFile<<"string1: "<<writeFile [i].string3<<",";
outFile<<endl;
}
Error 4 error LNK2019: unresolved external symbol "void __cdecl Display_file(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class std::vector<class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > > &)" (?Display_file@@YAXAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AAV?$vector@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$allocator@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@2@@2@@Z) referenced in function _main
//here, i wanted to read all the strings from file and display to screen like this:
void Display_file ( std::vector<std::string> &line_values, std::vector<std::vector<std::string> >&display){
std::string line = ""; //variable to hold lines being read from file
std::ifstream inFile("File.txt"); //opening text file in read mode by default i.e instead of inFile("Lands File.txt", ios::in)
int i;
while (std::getline(inFile, line))
{
std::stringstream ss(line); //a line is read into string stream as a strings //ss is not a must here
std::string vector_line; //variable to hold strings
while(std::getline(ss, vector_line)) // looping through the lines until it reach eof// this is not a must
{
line_values.push_back(vector_line); //reading a line into a vector (temporary in memory)
unsigned int size =display.size ();
for ( i= 0; display.size (); i++)
display.emplace_back(line_values); // pushing every line at the end of the sequence of the vector of vectors
cout<<line_values [i]; //display all line values by looping through lines ....displays all the file lines
cout<<endl; //move to newline
}
}
system ("pause");
inFile.close();
}
|