How to use Qt library with VisualStudio 2017? - c++

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.

Related

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.

Can not configure compiler and build kit for Qt 5.5

I just have installed on a clean windows 10, visual studio 2015 and Qt Creator 5.5...I have some source code that depend on some libraries (lib) files which I believe were compiled using msvc2012.
The Qt can not compile my project and always complains that selected compiler can not compile for Qt 5.5...I have spent hours on this but still no success...Would someone kindly tell me what should I do? Here is some photos of my Qt build options:
Visual C++ doesn't maintain binaries compatibility between versions, this means that you'll need to use the same Visual Studio version with all the libraries that are exposing C++ functionality (libraries that expose only a C interface can be used with different compiler version).
So you have 2 options:
1) install and use Visual Studio 2012, download and install a Qt version that is built with Visual Studio 2012 (Qt 5.5.0 for Windows 32-bit (VS 2012, 587 MB) ) Note that for VS 2012 there are only 32bit binaries available (if you want x64 you need to build Qt yourself)
or
2) if you want to use Visual Studio 2015, you'll need build Qt yourself with Visual Studio 2015, since there are no already built Qt binaries for Visual Studio 2015. And depending on how the other library is written you might need to also build that with Visual Studio 2015.

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 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.

How do I configure Qt to work with Visual Studio 2010?

I downloaded open-source version of Qt from the site and have compiled it with nmake, but I'm having trouble using it in my projects. It seems that Visual Studio can't find the Qt headers, even though I added the paths to my PATH, INCLUDE, and LIB variables. I tried installing the Qt Visual Studio add-in but it only supports Visual Studio 2008.
Has anyone gotten Qt to work with Visual Studio 2010? Or do I have to wait until Qt 4.7 is officially released for Visual Studio 2010 support?
Either download the pre-built vs2008 package or build it using cmake's vs2008 profile and then open the resulting .sln file in vs2010 and let it do the conversion.
edit - annoying feature so far is that the vs plugin doesn't support vs2010 which makes it essentially impossible to use for desktop app development.
Traditionally VS support was part of the paid licences, with the OS package you only get mingw support. Things are changing, but might have some rough edges for a while.
OTOH, mingw has a HUGE advantage: deployment. You don't have to chase around the vcredist_x86 files and all the associated voodoo. Just be sure to include all the .DLLs you use and that's it.
Also, there's QtCreator. It's not as featureful or omniscient as VS; but it does feel a lot nicer and easier to use. It takes off all the tedious work of nmake, and embeds the UI editors. And it's cross platform!
honestly, for me VS can drop dead this minute and i won't miss it.
Qt V4.8.0 contains prebuilt binaries for Visual Studio 2010 so you don't need to build manually anymore:
http://qt.nokia.com/downloads/windows-cpp-vs2010