title: Why does string type cause c++ program to not run?
body: <p>I have a simple program, written in C++, on a Windows 10 machine, compiled with the MinGW g++ compiler.</p>
  
  <p>I am including the <code>&lt;string&gt;</code> header, and it runs fine. When I include the <code>string</code> data type, it will compile, but it will not run.</p>
  
  <p>The minimum amount of code to reproduce this is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main() {
      string greeting;
      cout &lt;&lt; "hi" &lt;&lt; endl;
      return 1;
  }
  </code></pre>
  
  <p>Please note, <strong>this</strong> works fine:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main() {
      //string greeting;
      cout &lt;&lt; "hi" &lt;&lt; endl;
      return 1;
  }
  </code></pre>
  
  <p>The version of the compiler is 6.3.0<br>
  <code>g++.exe (MinGW.org GCC-6.3.0-1) 6.3.0</code></p>
  
  <p>I downloaded it 3 days ago, so I assume it is the most recent version. (Maybe not?)</p>
  
  <p>I have googled and browsed stackoverflow for answers.</p>
  
  <p>The closest question I could find, the person gave up and changed operating systems.</p>
  
  <p>One other solution I found was to use Cygwin's compiler. I would rather not, as I already have a seemingly otherwise fine compiler.  It seems that MinGW tools are widely used enough that I should be able to use the compiler.</p>
  
  <p>Any other forum/blog/etc resources have problems about converting strings or calling string methods.</p>
  
  <p><strong>NOTE:</strong> The same exact code runs fine on Ubuntu 16.04, with the included compiler.</p>
  
  <p>EDITS:</p>
  
  <p>While I realize that "It does not run" is not helpful, I don't know how else to describe it. I run the compiled program, and it behaves the same as if I entered <code>echo ''</code>. There is no output, no indication that anything has happened.  What is the most helpful way to phrase that behavior?</p>
  
  <p>If I use a debugger, I get <code>program exited with code 0xc0000139</code></p>
  
  <p>A quick google search returns results indication that it <em>is</em> a problem with the compiler. Same as the comments below about my compiler version...</p>
  
  <p>To compile the program, I run <code>g++ main.cpp -o b.exe</code>
  To execute it, I run <code>./b.exe</code></p>