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

4

13

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?

Bosk answered 24/2, 2011 at 0:0 Comment(7)
Express doesn't support add-ins, you need the retail edition.Soyuz
@Hans - that is true but you don't actually NEED the plugin to code Qt using Visual Studio. I'd certainly not recommend going without it, you'll be editing the custom build steps for EVERYTHING, but it can be done. This question seems to be more about whether the binaries supplied at Nokia work with the compiler anyway.Spoonerism
Out of curiosity, why don't you just use the Qt Creator IDE?Etch
@indienick: It's not out of the question, but I went down that path and I need to use a library that I think uses some non-standard c++ which I initially couldn't get to work. Specifically "__declspec(novtable)" which according to Microsoft is a Microsoft-specific extended attribute msdn.microsoft.com/en-us/library/k13k85ky%28v=vs.71%29.aspx. I figured using a microsoft compiler would solve the issue.Bosk
If you download and install Qt Creator, you should be able to update some settings so that it uses the 2010 compiler + the Qt libraries you just compiled. Much better experience for me than using the add-on, or using the tools in the build folder.Numismatics
@Fat Elvis: Ok I'm trying to compile my hello world app in Qt Creator while including the headers and lib for my 3rd party library. However, I'm getting "UINT" undeclared identifier.Bosk
Figured out the UINT issue. Needed to add #include <Windows.h>Bosk
B
4

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.

Bosk answered 24/2, 2011 at 1:29 Comment(0)
E
3

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.

Erde answered 25/2, 2011 at 14:23 Comment(0)
M
0

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

Mike answered 22/3, 2012 at 21:27 Comment(0)
P
-2

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.

Popedom answered 24/2, 2011 at 0:35 Comment(3)
As I'm using the express edition of visual studio, I don't think the add-in will work.Bosk
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 ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="..",type="win32",version="9.0.21022.8". 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.Bosk
@Bosk - yeah, I'm pretty sure you have to rebuild. Not firmly sure, which is why I haven't answered...but yeah...think you need to build Qt to get a 2010 compatible version. You might also want to change the /Zwchar_t switch: #4521752Spoonerism

© 2022 - 2024 — McMap. All rights reserved.