I know I’m probably doing something unforgivably stupid here, but for some reason my code won’t compile and I’m not sure why.
#include <iostream>
#include <list>
//A queue for the working set
//x,y co-ords of the square, path length so far
struct square {
int x;
int y;
int path_length;
} square;
list<square> workingset;
I have other code which appears to create a list in exactly the same way –
#include <iostream>
#include <list> //List class library
#include <algorithm> //STL algorithms class library (find)
using namespace std;
list<int> numberlist; //Creates my list
And the problem doesn’t appear to be because of the struct, as I have tried making a list of ints too, and it won’t work either.
The errors I am getting are –
syntax error : missing ‘;’ before ‘<‘ and missing type specifier – int assumed.
(Both on the line in which I am trying to declare a list)
So what incredibly stupid thing am I missing here? :3
The
listclass is defined in thestdnamespace, so you have to either do this:Or this