title: The C++ compiler doesn't work after MinGW is installed？
body: <p>I'm a C++ new learner and want to set my PC to learn coding. But the compiler doesn't work after all the MinGW packages were installed, and it doesn't show what goes wrong. How can I get it work?</p>
  
  <p>I'm using Windows 10 (64 Bit).</p>
  
  <p>All the MinGW packages were installed:
  <a href="https://i.stack.imgur.com/pE8gI.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>The Path was setted:
  <a href="https://i.stack.imgur.com/niyXA.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Use g++ -v to test, it's Ok, on the cmd it shows:</p>
  
  <p>C:\Users\shaun\Documents\cpp>g++ -v
  Using built-in specs.
  COLLECT_GCC=g++
  COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
  Target: mingw32
  Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls
  Thread model: win32
  gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)</p>
  
  <p><strong>But it doesn't work:</strong>
  C:\Users\shaun\Documents\cpp>g++ 1.cpp</p>
  
  <p>C:\Users\shaun\Documents\cpp>g++ 2.cpp</p>
  
  <p>C:\Users\shaun\Documents\cpp></p>
  
  <p>1.cpp is just a HelloWorld:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main() 
  {
  std::cout &lt;&lt; "Hello, World!";
  return 0;
  }
  </code></pre>
  
  <p>2.cpp is a simple loop:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  using namespace std;
  
  int main()
  {
      int n ;
      cout&lt;&lt;"please input the height"&lt;&lt;endl;
      cin &gt;&gt; n; 
  
      for (int i = 0; i &lt; n; i++)
      {
          for (int j = 0; j &lt; n - i -1; j++)
          {
              cout&lt;&lt;" ";
          }
          for (int j = 0; j &lt;= 2 * i; j++)
          {
              if (j == 0 or j == 2 * i)
                  cout&lt;&lt;"*";
              else
                  cout&lt;&lt;" ";
          }
          cout&lt;&lt;endl;
      }
  
      for (int i = 0; i &lt; n - 1; i++)
      {
          for (int j = 0; j &lt;= i; j++)
          {
              cout&lt;&lt;" ";
          }
          for (int j = 0; j &lt;= 2 * ( n - i - 2 ); j++)
          {
              if (j == 0 or j == 2 * ( n - i - 2 ))
                  cout&lt;&lt;"*";
              else
                  cout&lt;&lt;" ";
          }
          cout&lt;&lt;endl;
      }
      return 0;
  }
  </code></pre>