title: Cannot use auto keyword in VS Code while coding in C++
body: <p>I am using <strong>VS Code to code C++</strong>. It performs totally fine. But whenever I use <em><strong>auto</strong></em> keyword in my code, the program simply fails to Compile.</p>
  <p>For example, to iterate over a string <em><strong>my code without using auto keyword</strong></em> will look like</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int main()
  {
      string s(&quot;Hello&quot;);
      for(int i=0;i&lt;s.length();i++)
      {
          cout&lt;&lt;s.at(i)&lt;&lt;' ';
      }
      cin.get();
  }
  </code></pre>
  <p>It compiles find and <em><strong>runs giving Correct Output</strong></em>.</p>
  <blockquote>
  <p>Executing task: g++ -g -o helloworld helloworld.cpp</p>
  <p>Terminal will be reused by tasks, press any key to close it.</p>
  <p><strong>OUTPUT</strong> : H e l l o</p>
  </blockquote>
  <p>But whenever I try to perform the same job but <em><strong>using auto keyword</strong></em>, the code looks like</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int main()
  {
      string s(&quot;Hello&quot;);
      for(auto c:s)
      {
          cout&lt;&lt;c&lt;&lt;' ';
      }
      cin.get();
  }
  </code></pre>
  <p>But it gives <em><strong>Compile Time Error</strong></em></p>
  <pre><code>Executing task: g++ -g -o helloworld helloworld.cpp 
  
  helloworld.cpp: In function 'int main()':
  helloworld.cpp:7:14: error: 'c' does not name a type
       for(auto c:s)
                ^
  helloworld.cpp:11:5: error: expected ';' before 'cin'
       cin.get();
       ^
  helloworld.cpp:12:1: error: expected primary-expression before '}' token
   }
   ^
  helloworld.cpp:12:1: error: expected ')' before '}' token
  helloworld.cpp:12:1: error: expected primary-expression before '}' token
  The terminal process terminated with exit code: 1
  
  Terminal will be reused by tasks, press any key to close it. 
  </code></pre>
  <p><strong>Please help me out.</strong></p>