title: C++ Win32 API include <string>
body: <p>I'm trying without any luck to include <code>string</code>s in my C++ Win32 API beginner project.  The code won't compile if I define a <code>string</code>.  What's going on?</p>
  
  <hr>
  
  <p>Details:</p>
  
  <p>I was working in Dev C++, but now have switched to Code::Blocks using the (default?) "Gnu GCC Compiler".</p>
  
  <p>Here are the code cases I have tried, all similar, with their results:</p>
  
  <p>Compiles successfully:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;string.h&gt;  //&lt;string&gt; throws "no such file or directory"
  
  LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  {
  //...the rest works perfectly, omitted in following examples
  </code></pre>
  
  <p>Fails:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;string.h&gt;
  
  // Error: "string" does not name a type
  string myString;  
  
  // ...WndProc
  </code></pre>
  
  <p>Compiles successfully:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;string.h&gt;
  using namespace std;
  
  // ...WndProc
  </code></pre>
  
  <p>Fails:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;string.h&gt;
  using namespace std;
  
  // Error: "string" does not name a type
  string myString; 
  
  // ...WndProc
  </code></pre>
  
  <p>Fails:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;string.h&gt;
  
  // Error: expected constructor, destructor, or type conversion before "myString"
  // Error: expected ',' or ';' before "myString"
  std::string myString; 
  
  // ...WndProc
  </code></pre>
  
  <p>I asked this question a few days ago but deleted it because it seemed like a dumb question.  However, it wasn't solved and now has come back to haunt me.  Thanks in advance.</p>