title: Cannot Compile OpenCV 2.4.5 with VS 2013 RTM
body: <p>Has anyone had any luck compiling openCV with VS 2013 RTM? I have tried and get a bunch of &quot;min doesn't belong to namespace std&quot; &quot;max doesn't belong to namespace std&quot; in the IlmImf module, and opencv_features2d doesn't compile with the following error:</p>
  <p><strong>opencv\modules\core\include\opencv2/core/core.hpp(4512): fatal error C1075: end of file found before the left brace '{' at '......\modules\features2d\src\features2d_init.cpp(187)' was matched</strong></p>
  <p>Since the latest CMake UI doesn't yet support building with 2013 (at least from the UI and I'm a noob), my process was configuring CMake for 2012, and then opening the generated solution with 2013 and upgrading the compiler to vc12.</p>
  <p>I was able to get past the min/max errors by adding header includes for  in the 'offending' files, but I am stumped by the full error I posted above.</p>
  <p>Thanks</p>
  <p><strong>Update:</strong></p>
  <p>The accepted answer provides what is necessary to compile OpenCV in 32-bit debug and release, and 64-bit debug, but now the compiler fails to compile 64-bit release due to an internal compiler error. This is likely the compiler's fault at this point, but the answer is still solves many problems.</p>
  <p><strong>Update 2:</strong>
  So the 64-bit issue turned out to be a bug in the auto-vectorizer. Here is the corresponding workaround.</p>
  <blockquote>
  <p>Hi, thanks for the great bug report. I confirm this is a bug in the compiler optimizer. We will fix it in a future release.</p>
  <p>If you need a source code workaround, please turn the vectorizer off on the loop inside <strong>computeOrbDescriptor</strong>:</p>
  <p><strong>#pragma loop(no_vector)</strong></p>
  <p><strong>for (int i = 0; i &lt; dsize; ++i)</strong></p>
  <p><strong>{</strong></p>
  <pre><code>   **...**
  </code></pre>
  <p>That lets me build orb.cpp &amp; stardetector.cpp.</p>
  <p>If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to <a href="http://support.microsoft.com" rel="nofollow noreferrer">http://support.microsoft.com</a> or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.</p>
  <p>I am closing this MSConnect item. Feel free to respond if you need anything else.</p>
  <p>Thanks,</p>
  <p>Eric Brumer - Microsoft Visual C++ Team</p>
  </blockquote>
  <p>The connect bug can be found <a href="http://connect.microsoft.com/VisualStudio/feedback/details/804934/the-compiler-crashes-when-compiling-opencv-for-release-x64" rel="nofollow noreferrer">here</a>. Unfortunately the real fix for this is postponed until a later date.</p>