title: Using an STL List of a Struct in C++
body: <p>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. </p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include &lt;list&gt; 
  
  //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&lt;square&gt; workingset; 
  </code></pre>
  
  <p>I have other code which appears to create a list in exactly the same way - </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;list&gt;   //List class library 
  #include &lt;algorithm&gt; //STL algorithms class library (find) 
  
  using namespace std;
  
  list&lt;int&gt; numberlist; //Creates my list
  </code></pre>
  
  <p>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. </p>
  
  <p>The errors I am getting are -</p>
  
  <p>syntax error : missing ';' before '&lt;'  and  missing type specifier - int assumed.</p>
  
  <p>(Both on the line in which I am trying to declare a list)</p>
  
  <p>So what incredibly stupid thing am I missing here? :3 </p>