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

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.

Related

How can I set up Visual Studio 2017 to develop drivers?

According to this forum, https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-wdk-on-visual-studio-2017-community/fdbd2b44-e57a-4849-903d-04001205a764
Windows Driver Kit is not currently supported by visual studio 2017.
I tried installing the Windows Driver Kit, but the test driver projects, such as this one, fail to build
https://github.com/Microsoft/Windows-driver-samples/tree/master/serial/VirtualSerial
I get this error when building:
Error MSB8020 The build tools for WindowsUserModeDriver10.0 (Platform Toolset = 'WindowsUserModeDriver10.0') cannot be found. To build using the WindowsUserModeDriver10.0 build tools, please install WindowsUserModeDriver10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
I already tried retargeting the Solution to the two options I have: 10.0.17134.0 and 8.1, but the same error keeps coming up.
What do I need to do to build this sample driver? Do I need to install VS2015? VS2017 community edition? Why isn't this WDK supported by the Visual Studio 2017 professional version?
Thanks,
Visual Studio 2017 definitely supports kernel-mode device driver development; there's no doubt about that because I've been using VS17 for it for many, many months.
Use the latest version of Windows Driver Kit (WDK) which can be downloaded and installed from MSDN: https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
Furthermore, you can always use the Enterprise WDK and then you can simply build using that if you wanted to from command-line. (Also can be found on page linked-to above)
Download the correct WDK installer for your edition of Visual Studio 2017:
WDK for Windows 10, version 1809 for Visual Studio Community 2017
WDK for Windows 10, version 1803 for Visual Studio Professional 2017
WDK for Windows 10, version 1709 for Visual Studio Enterprise 2017
Visit https://learn.microsoft.com/en-us/windows-hardware/drivers/other-wdk-downloads for more information.
Not exactly a solution, but Windows 8.1 WDK works with Visual Studio 2017 Enterprise,
Download it from here, just need to retarget the project to 8.1
https://www.microsoft.com/en-us/download/confirmation.aspx?id=42273
In addition, I needed to get VS2015 C++ Build Tool to fix a missing Microsoft.cpp.props error
http://download.microsoft.com/download/5/F/7/5F7ACAEB-8363-451F-9425-68A90F98B238/visualcppbuildtools_full.exe
Developing drivers to windows is quite interesting one will be exposed to advanced Operating System Concepts.The set up for the environment will be IDE
IDE - Visual Studio (https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16)
Compilers (WDK)
Debugger (WDK)
WDK contains both(https://go.microsoft.com/fwlink/?linkid=2085767). Latest Visual Studio(VS2019) will come along with the latest WDK(10, 1903 as of now).
Sometimes plugins might not work properly i.e integration issues between Visual Studio and WDk.
By going to the location "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019" and run VSIX installer.
Now in a new project, driver related templates are available.

Qt Creator Compiler Config Issue visual studio 2017

I have a problem very similar to
Qt Creator Compiler Config Issue
I have a code in one computer that run with qt 5.4.2msvc2013. In this computer everything works fine, I have these packages installed for the kit:
Build & run kits
but now I am trying to run the same program in a new computer and I can not get my projects to 'Build and Run'.
I tried to install visual studio 2017 but it didn't work. I think the problem is that I don't know what do I have to install in the visual studio package to run something with Qt 5.4.2msvc2013 64bit2
Here is what I installed of visual studio 2017 in the computer that doesn't work
Visual Studio 2017
thank you for any help!
To compile VS2013/Qt5 project under VS2017 you need to install full VS2013 together with VS2017. I tried MS Build Tools but that's not sufficient because does not include unmanadged C++ compiler (cl.exe). Also, you need proper version of Qt itself and Qt VS Tools (aka Qt VS Addin). At the moment beta with VS2017 support is available.

Trying to build a Qt application with VC++ compiler: 'type_traits': No such file or directory

Why doesn't the compiler find the file? It exists in the VC include directory for VS 14.0.
I've read that in previous versions of Visual Studio, you have had to install a service pack or something, is this a similar case?
I'm using VS 2015 Community.
This seems to be resolved by running vcvarsall.bat and starting Qt Creator from the same command prompt window.
I had this same problem in Visual Studio 2019 Community with Qt 6.0.0
after, searching every forum etc.. and trying the install of Visual Studio 2015 build tools x64 and Visual Studio redistributable 2015 x64 (which didn't solve the problem too),
I tried updating Windows sdk version from 10.0.18362.0 to 10.0.19041.0 and the problem was SOLVED.
I'm currently using Visual Studio Community 4.8.03761 if that might help others
so just check that you have Window sdk version 10 updated and that your compiler is well chosen (I had mvsc2019_64 and work with LLVM etc.. version in build settings) .
hopefully this helps you guys.

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.

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.