Visual C++ 2010 Express: How to use with Qt?

User picture User · Feb 24, 2011 · Viewed 16.6k times · Source

I'm confused about getting Qt working with Visual Studio Express. Most of the searches online have turned up instructions for compiling Qt using instructions such as:

  • Install MSVC2005 or MSVC2008
  • Install the most recent Platform SDK (@ MSDN: "Platform SDK for Windows Server 2003 R2")
  • From the Platform SDK, you'll need to install at least the base + internet options
  • Then, download and extract a recent snapshot or the preview release to D:\Qt\4.x.x
  • Open up a console with the MSVC settings loaded (see MSVC Tools-menu) and go to your Qt directory
  • Type "configure -platform win32-msvc2005" without the quotation marks
  • That will build you the project files you'll need
  • After that, it's as simple as running "nmake" and drinking a lot of coffee

Then, add D:\Qt\4.x.x\bin and D:\Qt\4.x.x\lib to your path environment variable, and you'll be able to use this version of Qt from everywhere on your system. The latter could be added to the library section in the options from MSVC as well.

(from http://www.qtcentre.org/threads/11710-Visual-Studio-2005-Express)

However, when I go to the download page of Qt (http://qt.nokia.com/downloads), there is a download for Visual Studio labeled: "Qt libraries 4.7.1 for Windows (VS 2008, 228 MB)"

I'm confused, do I actually still need to build it? Or is it already built?

Answer

User picture User · Feb 24, 2011

Using the downloadable exe from qt (http://get.qt.nokia.com/qt/source/qt-win-opensource-4.7.1-vs2008.exe) does not seem to work with Visual Studio 2010. I tried building a simple hello world program from the command line which would not run. I'll repeat my comment from a previous answer.

I tried the hello world example from doc.qt.nokia.com/4.7/gettingstartedqt.html. I was able to build the project and an exe is generated. However, the exe fails to run and generates a system error dialog box about "side-by-side configuration is incorrect...". I ran SxsTrace and it says:

...
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\ 9.0.21022.8__...\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\qthello\debug\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\qthello\debug\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at C:\qthello\debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\qthello\debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86", publicKeyToken="...",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

To me, it looks like its trying to use VS2008 (which I don't have). It makes sense I guess since the download is for VS2008.

I was in the process of compiling qt 4.7.1 using the instructions in my question (using win32-msvc2010 as my platform target however) as I asked this SO question and the compilation finished. I rebuilt the hello world project and the exe runs. So it seems like the answer is in order to use with Visual Studio Express 2010 you currently do need to compile (at least until Qt releases a VS2010 download option). However, I believe if you are using VS2008 then you will not need to compile.