我在定义下面的课时遇到此错误:
int main(int argc, char *argv[])
{
vector<string> voteTallyFiles;
vector<voteTally> intermVoteTallies;
voteTally finalVoteTally;
string args;
voteTally returnValue;
void *returnValueP;
void *argp;
int index = 0;
//Grab vote tally files from Target Directory
getFileNames(voteTallyFiles);
vector<pthread_t> threads(voteTallyFiles.size());
//Count the votes using pthreads and a thread function
for (vector<pthread_t>::iterator iter = threads.begin(); iter != threads.end(); ++iter, index++)
{
args = voteTallyFiles[index];
argp = &args;
pthread_create(&*iter, NULL, &countVotes, argp);
}
// Wait for the threads
for (vector<pthread_t>::iterator iter = threads.begin(); iter != threads.end(); ++iter)
{
pthread_join(*iter, &returnValueP);
returnValue = *((voteTally*)returnValueP);
intermVoteTallies.push_back(returnValue);
}
// Aggregate sub-tallies
for (unsigned int i = 0; i < intermVoteTallies.size(); i++)
{
finalVoteTally.pres1 += intermVoteTallies[i].pres1;
finalVoteTally.pres2 += intermVoteTallies[i].pres2;
finalVoteTally.pres3 += intermVoteTallies[i].pres3;
finalVoteTally.pres4 += intermVoteTallies[i].pres4;
finalVoteTally.pres5 += intermVoteTallies[i].pres5;
}
return 0;
}
void* countVotes(void *argp)
{
string* actualArgs = (string*)argp;
string fileName = *actualArgs;
string line;
ifstream inFile;
voteTally *subTally = new voteTally;
inFile.open(fileName.c_str());
while (getline(inFile, line))
{
if (line == PRES1)
{
subTally->pres1++;
}
else if (line == PRES2)
{
subTally->pres2++;
}
else if (line == PRES3)
{
subTally->pres3++;
}
else if (line == PRES4)
{
subTally->pres4++;
}
else if (line == PRES5)
{
subTally->pres5++;
}
}
return subTally;
}
我正在使用eclipse。我已经在构建路径中添加了jar-android-support-v13.jar和android-support-v4.jar,但我仍然收到错误。请让我知道我在这里失踪了什么。
由于