title: expected initializer before ‘:’ token
body: <p>My code looks likes below:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  using namespace std;
  
      int main()
      {
       std::map&lt;int, std::vector&lt;int&gt; &gt; map;
       map[1].push_back(5);
       map[1].push_back(3);
       map[3].push_back(2);
       map[2].push_back(1);
       map[1].push_back(-1);
       map[3].push_back(2);
  
       int sum2 = 0;
       for (const pair&lt;int, vector&lt;int&gt; &gt;&amp; index_vec : map) 
        {
          int sum = 0;
           for (int elem : index_vec.second) 
          { 
              sum += elem; 
          }
          sum2 += sum*sum;
           cout &lt;&lt; "index " &lt;&lt; index_vec.first &lt;&lt; ": " &lt;&lt; sum &lt;&lt; endl;
        }
      cout &lt;&lt; "sum_2: " &lt;&lt; sum2 &lt;&lt; endl; 
      return 0;
      };
  </code></pre>
  
  <p>Which works fine in my laptop but when using desktop gives me following erors:</p>
  
  <pre><code>map.cpp: In function ‘int main()’:
  map.cpp:17: error: expected initializer before ‘:’ token
  map.cpp:29: error: expected primary-expression at end of input
  map.cpp:29: error: expected ‘;’ at end of input
  map.cpp:29: error: expected primary-expression at end of input
  map.cpp:29: error: expected ‘)’ at end of input
  map.cpp:29: error: expected statement at end of input
  map.cpp:29: error: expected ‘}’ at end of input
  </code></pre>
  
  <p>The output should be:</p>
  
  <pre><code>index 1: 7
  index 2: 1
  index 3: 4
  sum_2: 66
  </code></pre>
  
  <p>which my laptop gives as expected. I have absolutely no idea, could soeone please help me out?</p>