title: How to build Qt for Visual Studio 2010
body: <p>I struggled finding a how-to which provides a stable solution for using Qt with Visual Studio 2010, so after collecting all the bits of information and some trial and error, I would like to write my solution into a guide.</p>
  
  <h2>The problem, or why is it not possible to use prebuilt binaries?</h2>
  
  <p>It seems that using binaries built for Visual Studio 2008 might work in some special cases, but I found them not to work. In my case they compiled OK, but they produce runtime errors, like this:</p>
  
  <p><img src="https://i.stack.imgur.com/LvWOd.png" alt="problem2"></p>
  
  <p>or when started from Visual Studio 2010:</p>
  
  <p><img src="https://i.stack.imgur.com/cXTle.png" alt="problem"></p>
  
  <p><strong>Update</strong>: I found a blog post analysing why does it work for some people, while it does not for others. In one word, it depends on whether you have Visual Studio 2008 installed on the same machine, or not.
  <a href="http://blog.paulnettleship.com/2010/11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/" rel="noreferrer">http://blog.paulnettleship.com/2010/11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/</a></p>
  
  <blockquote>
    <p>The most important thing (that I stupidly didn’t realize) was the fact that you CANNOT use the Visual Studio 2008 compiled libraries and dll’s (available on the Qt webpage) if you don’t have Visual Studio 2008 installed. The reason is because the Qt SDK you download is a debug build which is dependant on the VC9.0 DebugCRT, meaning it needs the Visual C++ 2008 Debug Runtime installed, which is NOT available as a redistributable installer. The only way to install the DebugCRT is to install the entirety of Visual Studio 2008.</p>
  </blockquote>