Installing Qt 5.5 on Windows 7 - c++

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.

Related

How to use Visual Studio 2017 with Qt to develop GUI applications?

I have searched everywhere but I can't seem to find support for the latest Visual Studio version.
Is there some way of getting round this?
Qt 5.9.1 and later versions are pre-built for VS 2017 64 bits. You can download it from official Qt webpage. If you need 32 bits I'm sorry to tell you that you will need to compile it manually (good luck, it is usually not a straightforward nor simple process). See updates below.
In addition, you will need the VS Tools. You can download latest version for VS 2017 from here (official downloads page hasn't been updated yet about this). There is no stable version for VS 2017 (see update below), but the latest (although a bit old) development build fixes major integration problems. You can downloaded from here.
Finally, just take a look at the official documentation for a quick tutorial about how to use it. Basically:
Configure your Qt version with the VS Tools: in VS go to Qt VS Tools > Qt Options and add your installation.
You can now create a new project. The extension will add a new templates collection under Visual C++ called Qt, there you will probably use the Qt GUI Application.
The rest is standard Qt programming. The VS Tools take charge of all the compilation of .ui files (interface design), moc'ing needed files, translations (if used), etc.
UPDATE: as mentioned in this post from MSDN, binaries generated usign VS 2015 are compatible with VS 2017. So in this case, the Qt compilations for 2015 (32 and 64 bits) should also work.
UPDATE (2018-9-13): since two months ago we've been using the 32-bits build from VS 2015 in VS 2017 (including the latest 15.8.4 update). No issues found so far in this sense.
UPDATE (2018-12-10): Qt 5.12.0 (LTS) comes with precompiled binaries for VS 2017 32 and 64 bits.
UPDATE: last February was launched the first official release of the VS Tools for VS 2017. You can read more on it in the Qt's blog.

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.

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

How to compile C++ for Windows with clang in Visual Studio 2015

As far as I understand, Visual Studio 2015 is shipped with clang. First I though this was only for Android and iOS apps, but according to this article it should also be possible to use the clang++ frontend for Windows programs. However, I can't find the according option.
So could you please explain to me, how I can change the used compiler to clang in a c++ project (in VS2015 RC Community Edition).
Starting with VS2015 Update 1 you can install the "Clang with Microsoft CodeGen" template via the New Project window, browse to Installed -> Templates -> Visual C++ -> Cross Platform.
You will then be able to choose the Clang 3.7 with Microsoft CodeGen v140_clang_3_7 Platform Toolset in the properties page of any Windows C++ project.
Clang has a completely different set of command-line options which it recognizes, so when using the v140_clang_3_7 toolset, the project properties must be using Clang-compatible options, which can be recognized as starting with - instead of /. For example, Debug Information Format property set to "Full Debug Information (DWARF2) (-g2 -gdwarf-2)", and Enable C++ Exceptions property set to "Yes (-fexceptions)".
There's more information in this blog post.
As far as I understand it both Clang and GCC are shipped with the Android and iOS crossplatform SDKs/tools for Visual Studio 2015.
From what I've seen it only allows me to choose those while having one of those crossplatform projects.
Using the template project for a GLES C++ application you get the following options:
While for a Windows C++ application you get the dialog below where you can see that Windows target platform is grayed out and read-only, meaning you probably have a set of toolkits for each target platform, but you simply cannot change it, at least for now.
Have no idea how you turn a normal VS project into crossplatform though, and it's likely that you can only target Android or iOS out of the box using 3rd party compilers.
It may be possible, though, to install Clang as another toolkit in the same way the XP toolkits are. So perhaps it's just a matter of someone fiddling with it and making it available as it is already installed.
Caveat: This answer is pre-VS2015 update 1 which didn't have the "Clang with Microsoft CodeGen" option.
After reading through the linked post and especially the comments again, I came to understand, that this is not a feature shipped with VS2015 RC but a possible future feature that might e.g. be shipped in a SP or (more likely) with the next version of VS.
As mentioned by sjdowling, the closest thing you can do at the moment (October 2015, clang 3.7) is to download and install llvm for windows. This should give you a LLVM-vs2014 platform toolset option. For me it works for simple test programs, but apparently this version of "clang-vs" seems to not yet support exceptions. However, according to these notes, that problem should be mostly solved for clang 3.8.
While the above solutions work they require that you have installed clang which is off by default in the visual studio 2015 installation. The accepted answer does show how to install it, though the next page will ask you to close visual studio which you are running the new project from.
If anyone is wondering how to install clang because it does not show up in their list here is another solution:
Control Panel->Programs->Programs and Features.
Right click on “Microsoft Visual Studio Enterprise 2015” (or
“Microsoft Visual
Studio 15 Preview” if you have the preview of the next version of
Visual Studio installed)
Click “Change”
Click “Modify”
Select “Clang with Microsoft CodeGen” – The March 2016 release.
https://blogs.msdn.microsoft.com/vcblog/2016/03/31/clang-with-microsoft-codegen-march-2016-released/

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

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.