/tmp/ccQQwq6l.o: In function main':
hw4.cpp:(.text+0x7d): undefined reference to
writepass(std::vector >, std::vector, std::allocator > >&)'
collect2: error: ld returned 1 exit status
code is ass follows
#include<iostream>
#include<cstdlib>
#include<string>
#include<fstream>
#include<ctime>
#include<vector>
using namespace std;
//cout << "test1\n";
vector<pair<string,string> > readnames();
vector<string> readpasswords();
vector<string> randpasswords(vector<string>&);
int writepass(vector<string>, vector<pair<string,string> >&);
vector<string> passwords;
vector<pair<string,string> > names;
vector<string> randpass;
int main()
{
readnames();
readpasswords();
randpasswords(passwords);
writepass(randpass, names);
// writepass(randpasswords(readpasswords()), readnames());
return 0;
}
this reads the names for a file on my cpu
vector<pair<string,string> > readnames()
{
vector<pair<string,string> > names;
ifstream indata;
indata.open("employees.txt");
while (true)
{
pair<string, string> name;
if (!(indata >> name.first >> name.second))
break;
names.push_back(name);
}
indata.close();
return names;
}
this read paswords from a file on my cpu
vector<string> readpasswords()
{
vector<string> passwords;
ifstream indata;
indata.open("passwords.txt");
while(!indata.eof())
{
string password;
if (!(indata >> password))
break;
passwords.push_back(password);
}
indata.close();
return passwords;
}
this function im not concerned about yet
vector<string> randpasswords(vector<string>& passwords)
{
vector<string> randpass;
vector<string> rand;
srand (time(NULL));
return randpass;
}
this seems to be generating the problem
int writepass(vector<string>& randpass, vector<pair<string,string> >& names)
{
ofstream outdata;
outdata.open("empPasswords.txt");
for(int i = 0; i < randpass.size();i++)
{
outdata << names[i].first << " " << names[i].second << " " << randpass[i] << endl;
}
outdata.close();
return 0;
}