title: MinGW error: 'min' is not a member of 'std'
body: <p>I'm trying to convert some VC++ 6 code to a console app using only the standard libraries but am getting the following error from MinGW (whatever version is supplied with the Code::Blocks 10.05 IDE):</p>
  
  <pre><code>error: 'min' is not a member of 'std'
  </code></pre>
  
  <p>This is related to the following line of code:</p>
  
  <pre><code>L.Precision=std::min(1.e-4,0.001*res);
  </code></pre>
  
  <p><code>L.Precision</code> is a <code>double</code>, and <code>res</code> is a <code>double</code>. Previously this line was:</p>
  
  <pre><code>L.Precision=min(1.e-4,0.001*res);
  </code></pre>
  
  <p>But this gives the error:</p>
  
  <pre><code>error: 'min' was not declared in this scope
  </code></pre>
  
  <p>Here are the headers in the file in question:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  //#include&lt;algorithm.h&gt;
  #include &lt;malloc.h&gt;
  #include "complex.h"
  #include "mesh.h"
  #include "spars.h"
  #include "FemmeDocCore.h"
  </code></pre>
  
  <p>I understand that this may be related to some macros defined in the file <code>windef.h</code>, but correct me if I'm wrong about this. </p>
  
  <p>What exactly can I do about this? I'm relatively new to C++, and am not even sure where <code>windef.h</code> is called for instance, I presume this is just needed for every windows program and is added at some point by MinGW. I want the final code to be cross-platform.</p>