我一直收到LNK2019错误,但不确定如何解决



这是我的整个程序。我一直得到的错误是:

错误LNK2019未解析的外部符号"void __cdecl getPIN(类std::vector<int,类std::allocator>)"(?getPIN@@YAXV?$vector@HV?$allocator@H@std@@@std@@@ @ z)在函数main

中引用我不太确定是什么问题,或者我在这里做错了什么。

#include <iostream>
#include <vector>
using namespace std;
// Function Prototype
bool testPIN(vector<int>, vector<int>);
void getPIN(vector<int>);
int main()
{
vector<int> databasePIN { 2, 4, 1, 8, 7, 9, 0 }; // Base set of values.
vector<int> customerPIN(7);
getPIN(databasePIN);

}

bool testPIN(vector<int> custPIN,vector<int> databasePIN)
{
for (int index = 0; index < databasePIN.size(); index++) {
if (custPIN.at(index) != databasePIN.at(index))
return false; // We've found two different values.
}
return true; // If we make it this far, the values are the same.
}
void getPin(vector<int> custPIN)
{
int input;
for (int index = 0; index < custPIN.size(); index++) {
cin >> input;
custPIN.push_back(input);
}
}

您已经定义了

void getPin(vector<int> custPIN)
---------^^
{
int input;
for (int index = 0; index < custPIN.size(); index++) {
cin >> input;
custPIN.push_back(input);
}
}

但是调用getPIN

相关内容

最新更新