title: C11 and C++11 problems in Sublime Text 3
body: <p>I upgrade my Sublime Text 3 for C/C++ but I have to write code in modern versions like C11 and C++11.</p>
  
  <p>When I try C11 code like this:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main( int argc, char ** argv )
  {
      puts("C99 Version:");
  
      for( int i = 0; argv[i]; i++ ) {
          printf("%d: %s\n", i, argv[i]);
      }
      getchar();
      return 0;
  }
  </code></pre>
  
  <p>Sublime gives an errors:</p>
  
  <pre><code>C:\Users\pc\Desktop\CPPproject\c99.c:7:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for( int i = 0; argv[i]; i++ ) {
    ^
  C:\Users\pc\Desktop\CPPproject\c99.c:7:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
  </code></pre>
  
  <p>Can You explain me how to use -std=c99, -std=gnu99, -std=c11 or -std=gnu11 options?</p>
  
  <p>==================================================================================</p>
  
  <p>The same thing with C++11. Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main( int argc, char ** argv ) {
  
      stringstream version;
      version &lt;&lt; "GCC version: "
              &lt;&lt; __GNUC__ &lt;&lt; "." &lt;&lt; __GNUC_MINOR__ &lt;&lt; "." &lt;&lt; __GNUC_PATCHLEVEL__
              &lt;&lt; "\nVersion string: " &lt;&lt; __VERSION__;
  
      cout &lt;&lt; version.str() &lt;&lt; endl;
  
      vector&lt;string&gt; v = { "one", "two", "three" }; // C++11 feature - initializer list
  
      for( string s : v ) {   // C++11 feature - range-based for loop
          cout &lt;&lt; s &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>and a list of errors:</p>
  
  <pre><code>C:\Users\pc\Desktop\CPPproject\main.cpp: In function 'int main(int, char**)':
  C:\Users\pc\Desktop\CPPproject\main.cpp:17:45: error: in C++98 'v' must be initialized by constructor, not by '{...}'
    vector&lt;string&gt; v = { "one", "two", "three" }; // C++11 feature - initializer list
                                               ^
  C:\Users\pc\Desktop\CPPproject\main.cpp:17:45: error: could not convert '{"one", "two", "three"}' from '&lt;brace-enclosed initializer list&gt;' to 'std::vector&lt;std::basic_string&lt;char&gt; &gt;'
  C:\Users\pc\Desktop\CPPproject\main.cpp:19:18: error: range-based 'for' loops are not allowed in C++98 mode
    for( string s : v ) { // C++11 feature - range-based for loop
                    ^
  </code></pre>
  
  <p>Help me solve these problems please!</p>
  
  <p>And another one question: When I run the code - .exe file appears in the same folder with source code and I have to open it. Are there any possibilities to see the output inside Sublime Text when I click "ctrl+b" ???</p>
  
  <p>Thank's !!!</p>