I’m currently getting the following compile errors:
In function 'int main()':
error: expected primary-expression before '>' token
error: missing template arguments before 'i'
error: expected ';' before 'i'
error: 'i' was not declared in this scope
I’ve highlighted the line the first error flags on in the code block below:
// test highscoresfilemanager reading & writing
/*
HighScorePair paira("holly", 10);
HighScorePair pairb("carl", 20);
*/
list< HighScorePair > list;
//list.push_back(paira); list.push_back(pairb);
HighScoresFileManager::GetInstance()->ReadFileToList(list);
list< HighScorePair >::iterator i; //ERROR FLAGS HERE ODDLY
for(i = list.begin(); i != list.end(); ++i)
std::cout << (*i).playerName << " " << (*i).playerScore << std::endl;
I left in some commented out text I was using to test something previously because I’m certain that that commented out text works perfectly and if it works I don’t see why the new code I’ve added wouldn’t work, I’m not using any new classes or anything, I’ve just tried to get an iterator setup.
I feel quite rude as I think I’m basically asking someone to check my syntax, I keep reading over it and thinking I must be missing a colon somewhere or something but I just can’t see what the issue is! A new eye would be greatly appreciated! I appreciate you might want more code (which I can provide) but like I said if the stuff commented out worked then I think the new code should to.
Don’t call your variable
list.