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

16.7k views Asked by At

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?

4

There are 4 answers

0
User On BEST ANSWER

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.

0
Sascha On

The Qt binaries provided by Nokia for Windows target either MinGW or Visual Studio 2008, both for compiling 32bit executables. If you need Qt binaries for VS 2005 (32bit), you may find them in their archives.

For everything else, you need to compile Qt yourself. Especially for:

  • Visual Studio 2008 64 bit
  • Visual Studio 2008 Express Edition 64 bit: You need the Windows SDK 7.0 which provides the 64 bit compilers and compile Qt with those.
  • Visual Studio 2010 32 bit and 64 bit

In general, you cannot link libraries compiled with different compilers, i.e. use the Qt binaries built with VC 9.0 (VS 2008) 32 bit and link them to an executable built with VC 10.0 (VS 2010) 32 bit.

3
the JinX On

http://qt.nokia.com/downloads has a link called qt-vs-addin-1.1.7.exe (57 MB)

You'll probably need that one as well . .

I don't think you need to compile the libraries since there is a download for them now . .

So get the 228 MB of libs and 57 MB plugin and you should be set.

DISCLAIMER: I don't use MSVC (yet?) so please let me know if it works.

0
Salvatore Dario Minonne On

Just a small update on this. Downloading the QTSDK (and using cmake instead of qmake everything looks like working quite well. Except for the fact that the installer of QTSDK didn't update the path for qmake.exe and you've to do by hand.

Tested with QtSDK 4.8 and visual studio express 2010