title: #define NOMINMAX using std::min/max
body: <p>i recently added:</p>
  
  <pre><code>#define NOMINMAX
  #include &lt;Windows.h&gt;
  #include &lt;algorithm&gt;
  </code></pre>
  
  <p>to my main.cpp in order to use </p>
  
  <pre><code>std::max( x , x ); // x is just a placeholder and not actual anything
  std::min( x  , x );
  </code></pre>
  
  <p>but i can't use <code>std::max()/std::min()</code> in other files.</p>
  
  <pre><code>error C2589: '(' : illegal token on right side of '::'
  error C2059: syntax error : '::'
  </code></pre>
  
  <p>i tried to add <code>#define NOMINMAX</code> in my other files, but fails. what is the clue?</p>
  
  <p>i looked around before asking, but i don't understand the answer <a href="https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c">Possible problems with NOMINMAX on Visual C++</a></p>