title: During startup program exited with code 0xc0000139
body: <p><strong>UPDATE:</strong></p>
  
  <p>This turned out to be a compiler issue (I was using <em>MinGW</em>) so a <strong>workaround</strong> is switching to another compiler (in this case <em>Cygwin</em>).</p>
  
  <hr>
  
  <p><strong>The (original) question</strong></p>
  
  <p>I'm a student starting to learn <strong>C++</strong> by myself and I have come across a problem when trying to work with <code>string</code></p>
  
  <p>This is my test code (the one that isn't working)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
      string myString;
  
      cin &gt;&gt; myString;
      cout &lt;&lt; myString;
  
      return(0);
  }
  </code></pre>
  
  <p>When I tried to run it, the program just ended and exited <strong>before I can input anything</strong>, and this is the result when I tried to run from <code>gdb</code></p>
  
  <pre><code>(gdb) run
  Starting program: C:\Users\DANIEL~1\AppData\Local\Temp\sandbox.exe
  [New Thread 15036.0x31bc]
  [New Thread 15036.0x2db4]
  [New Thread 15036.0x2628]
  [New Thread 15036.0x2280]
  During startup program exited with code 0xc0000139.
  (gdb)
  </code></pre>
  
  <p>When I tried to make the file and run it from cmd</p>
  
  <p><code>g++ sandbox_string.cpp -o sandbox_string</code> </p>
  
  <p>(I added the _string to separate from the _int makefile, the program is still the same)</p>
  
  <p>I got this error:
  <a href="https://i.stack.imgur.com/uUbFq.png" rel="noreferrer">Entry point not found</a></p>
  
  <p>After a trip round Google I believe that this problem is related to <em>missing DLLs</em>. How can I know what dll(s) I'm missing and is there a way to make sure I have every dlls ?</p>
  
  <p><strong>There are some points I would like to mention:</strong></p>
  
  <p>• I'm acknowledged that this may be a duplicate to <a href="https://stackoverflow.com/questions/33969123/why-are-all-my-c-programs-exiting-with-0xc0000139">Why are all my C++ programs exiting with 0xc0000139?</a>, but that provided no solution other than downgrading GCC. I tried that and it didn't work. Also in that question someone mentioned about <em>missing DLLs</em>, but provided no further solution.</p>
  
  <p>• If I tried to <code>cin</code> an integer for example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
      int myString;
      cin &gt;&gt; myString;
      cout &lt;&lt; myString;
      return(0);
  }
  </code></pre>
  
  <p>It works fine, I can input and the program would output then exit normally:</p>
  
  <pre><code>(gdb) run
  Starting program: C:\Users\DANIEL~1\AppData\Local\Temp\sandbox.exe
  [New Thread 9120.0x35ac]
  [New Thread 9120.0x2c4c]
  [New Thread 9120.0x390c]
  [New Thread 9120.0x32c0]
  7
  7[Inferior 1 (process 9120) exited normally]
  (gdb)
  </code></pre>
  
  <p>• My compiler is <em>MinGW</em>, this is my MinGW installer screenshot with (hopefully) every details you need
  <a href="https://i.stack.imgur.com/PRiz3.png" rel="noreferrer">MinGW Installer</a></p>
  
  <p>• I'm using <em>Atom</em> - a text editor, with a plugin to compile and run C++ code (called "gpp-compiler") because I find it comfortable to stick with one text editor instead of using IDEs, <strong>but</strong>, if you think there's something else I should be using, please let me know.</p>
  
  <p>• I'm not new to programming but I'm (very) new to C++ so please pardon me if there is any silly mistake, also this also means that I greatly prefer <strong>simple answer/solution if possible</strong>. But I will have no problem with complicated answer that's accompanied by a proper explanation. </p>
  
  <p>Thanks</p>