How to use Qt5 and Qt Creator 2.6.1 with compiler from VS 2012? - c++

The official downloads only include Qt libraries 5.0.0 for VS 2010 now. I tried them in VS 2012 Express but got an error message as "error: LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700'..."
Do I have to install VS 2010 or compile the entire source code of Qt5 in VS 2012?
UPDATE: My IDE is Qt Creator 2.6.1. I only use the C++ compiler in VS 2012 because there are no Qt libraries 5.0.0 for minGW in the official downloads yet.
UPDATE-2(2013-1-1): Saw it today, the official blog says:
There are a few things we’re still working on for the 5.0 series. We
have bugs that we want to fix. We currently do not have binary
packages for MinGW (as WebKit doesn’t yet work with it yet) and MSVC
2012 (you’ll need to compile from source), and we’ll work on
delivering these as soon as possible. The current plan is to have a
first patch level release, 5.0.1, some time before the end of January.
UPDATE-3(2013-1-31): That comes finally, but only adds Qt 5.0.1 for MinGW 4.7.
UPDATE-4(2013-7-06): After a long wait, Qt 5.1.0 for Windows 32-bit (VS 2012, 511 MB) added.

You are right - if you want to use MS VC 2012 compiler, you have to compile QT5 libraries manually. The tutorial can be found on http://qt-project.org/wiki/Building_Qt_5_from_Git.
Another option is to install VS 2010 and use it until Digia will make pre-compiled VC 2012 and MinGW libraries. If you use QT Creator as your primary IDE, it should be enough to install VC 2010 Express only.

What do you have set in Visual Studio 2012?
Project properties > General > Platform toolset
Try setting it to v110.
More info at MSDN.

Related

How to configure a usable Kit for Qt after reinstalling Visual Studio 2017

I reinstalled Visual Studio 2017 and just couldn't configure a working Kit for Qt.
Summary:
At the very beginning, I had both Qt5.9.8 MSVC2017_64bit and Visual Studio 2017 installed on my computer. They just worked fine. Then I updated Visual Studio to 2019 and uninstalled VS2017. Then my Qt Creator broke down. When I try to open a Qt project created before, it just prompts me that "No valid kits found".
What I tried :
I tried to reinstall something 'needed', attempting to restore something for Qt to work. So I opened Visual Studio Installer, checked to install Single Component "VC++ 2017 version 15.9 v14.16 latest v141 tools" of Visual Studio Enterprise 2017. Then I opened Qt Creator 4.8.2, Menu->Tools->Kits, manually added a clang-cl C and C++ compiler and set the compiler path each to "C:\Program Files (x86)\Microsoft Visual Studio\2017\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe".
I also tried some combinations between Hostx64, Hostx86 and x64, x86 when selecting the path. But none of then succeeded.
Besides, I have heard and taken a shot on Qt VS Tools.
Related environments:
Microsoft Visual Studio 2019 Enterprise
Microsoft Visual Studio 2008 Professional (whose compiler was
auto-detected in Qt but not usable)
Qt 5.9.8 MSVC2017_64bit
Question :
Would anyone tell me what I can do to solve this troubling problem?
cl.exe is not clang, so you will not make it work by forcing cl.exe into a clng configuration in Qt Creator.
As of today, there is no way to set an MSVC compiler toolchain manually in Qt Creator. The only way is to have it auto-detected. If your MSVC toolchain is not detected, the first thing to do is to update Qt Creator (current version is 4.9.2) becaue each released of Qt Creator has improved detection methods for the new MSVC releases.
I know that Microsoft has standardized the way to detect installed toolchains with 2019. So if you use MSVC 2019 + Qt Creator 4.9+, yous should not have any problem.
Note that in the past Qt Creator had issues with:
MSVC Build Tools (MSVC toolchain without Visual Studio GUI)
Installing old toolchains with new installer e.g. installing MSVC 2015 as part of Vistual Studio 2017 installation.
Also, by default Visual Studio does not install the command line debuger by default. You need to go to "Add and remove programs" and modify the Windows SDK installation by enabling the debug tools.

How to use Qt library with VisualStudio 2017?

At the official Qt library site present only Qt add-in for Microsoft Visual Studio 2013 and 2015. And there are no one for MSVS 2017.
How to use Qt library with visual studio 2017 in this case?
You can get the add-in beta here, it should be mostly working. I mean if you want IDE integration. Otherwise it should build fine via the build tools command prompt (or however they call it now) via qmake project and then make.
As for building the Qt framework itself, it should probably work too, maybe with the exception of the QWebEngine stuff. It also seems that MSVC 2017 and 2015 are binary compatible, so it may be possible to use Qt binaries, built with MSVC 2015, therefore making it an option to avoid building Qt from source.
IIRC the incoming version 5.9 will offer MSVC 2017 prebuilt binaries.

Installing Qt 5.5 on Windows 7

I would like to install latest version of Qt (5.5) on Windows 7 for C/C++ application development, and have a few questions:
Can I use Microsoft "Visual Studio Community" edition (2015) as the compiler?
I assume I need to install Visual studio first and then Qt?
I am going to install Qt from here, after downloading and installation do I need to build Qt? Or it is ready to go?
Is there a tutorial that explains all the required steps in details. I have done Google search and found bits and pieces here and there not not a good complete step-by-step reference.
Thanks for the help.
You need the compiler, which is integrated in visual studio. I don't think you can get the newer ones without Visual Studio (From official sources). However, you can use Qt on windows without msvc. You can build with the minGw compiler - but I personally like msvc more.
Regarding VS2015: It won't work without extra configuration. Qt 5.5 supports msvc2013 only (the next release, 5.6, will support the msvc2015 compiler). But Visual Studio 2013 will work. The order of installation doesn't matter.
After you installed Qt, all you need to do is launch Qt-Creator and start coding ;) If you wan't to use Visual Studio instead, there is a Plugin on the bottom of the download page ("Other downloads"). Visual Studio 2015 isn't supported here too, but 2013 is.

Qt msvc2013 building with vs2015

Hi I have updated visual studio to 2015 version and I have Qt msvc2013. Qt says that no compilers can make code for this version of Qt, (Qt detected compilers from visual studio). How can I make it working without installing VS2013?
You cannot mix C++ compiled with different major versions of the Microsoft Visual C++ compilers. So you need to either get a version of Qt for Visual Studio 2015, or compile your own one.
At this time, there is not yet an official build of Qt for Visual Studio 2015 available (this is planned for Qt 5.5.1 5.6.0). If you want to try compiling yourself, https://wiki.qt.io/Building_Qt_5_from_Git is a comprehensive guide. You should try either the 5.5 branch (if you get the Qt sources from git), or the 5.5.0 source packages. You should be able to get help e.g. on the qt-interest mailing list.
Adding a new mkspec is pretty simple, just copy the win32-msvc2013 and rename it to win32-msvc2015, then modify and use that one.
Second thing to do is not try to link against 2013 built libraries. If 2015 follows the same pattern as the older one, mixing libraries from different VS version is not possible.
Last thing, before adding icu, OpenSSL and MySQL you rather try to build Qt with the default parameters.
Qt's current development version is 5.6.
It is in beta and there are prebuild binaries for msvc2015.
Link to Qt Development Binaries

Qt 4.7.1, Qt Creator and VS 2010 installation problems

On my computer (Win7 32, VS2010 Ultimate) I would like to use Qt Creator and Qt Visual Studio add in, both LGPL versions.
There are minGW and VS2008 versions of Qt frameworks on the Nokia websites, I did not find VS 2010 version.
So I have installed Qt 2010.05 SDK and in the VS 2010 Command prompt the following steps have been performed:
configure -static
nmake sub-src
I checked Qt Creator and it successfully runs. After the translation has been finished I installed VS 2010 add I tried to add new Qt version int the path
C:\Qt\2010.05\qt
But the following error message has been appeared:
Qt in the given path was built using minGW
It do not understand why because the translation has been performed for the VS2010.
Where is the error? How to install it correctly?
I found out from a German Qt forum that, VS add-in looks for libqtmain.a and libqtmaind.a files to determine if it is built with MinGW. Guess what? Qt ships with those files.
Delete them, and you will be fine.
FWIW, The Vs2008 version works fine with VS2010. I didn't need to build it or anything. You can install that and then just run the latest version of the VS plug-in installer and you should see the Qt menu options in VS2010.
AFAIR your command line is incomplete: I remember one had to specify the build platform. It could be that it's using mingw to build Qt since you didn't specify the VS version in the parameters. The following post might be of interest to you: Building Qt 4.5 with Visual C++ 2010