开发者

Undefined symbols error in C++ / Eclipse [closed]

开发者 https://www.devze.com 2022-12-14 05:37 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号