Undefined symbols error in C++ / Eclipse [closed]
I have a function to display the values of a vector in a table, but I keep getting an "Undefined symbols" error when linking.
Here is my function prototype:
void displayVectors(vector<string> & nameVec, vector<double> & scoreVec, vector<char> & gradeVec);
Here is the definition:
void dipslayVectors(vector<string> & nameVec, vector<double> & scoreVec, vector<char> & gradeVec) {
for (int i = 0; i < nameVec.size(); i++) {
cout << setw(12) << nameVec[i]
<< setw(8) << scoreVec[i]
<< setw(2) << gradeVec[i]
<< endl;
}
}
Here's where I called it:
displayVectors(nameVec, s开发者_C百科coreVec, gradeVec);
I'm certain nameVec, scoreVec, and gradeVec are all the right types of vectors, and I have all the libraries included, so I'm stumped. I've seen other people on Google have problems with vectors like this, but they always found some error they made. Does anyone have any ideas?
Assuming you cut & pasted your question directly, then void dipslayVectors
is a misspelling in the definition
From your code there may be 2 possible source of errors :
1.dipslayVectors is mispelled.
2.you might not have defined actual parameters.
3.One suggestion is make function const since its only reading the data and make formal parameter as reference to const data.
精彩评论