Qt Creator Compiler Config Issue visual studio 2017 - c++

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.

Related

Why do I get "Illegal Instruction" error when Building on windows10 and running on Windows7

I have a c++ program built using VS2017 on windows7.
When I run it on Windows7 or windows10 there is no problem.
If I Build the same program on Windows10 (still using VS2017) the program runs OK on Windows10 but when I try to run it on Windows7 I get an "0xC000001D: Illegal Instruction." error.
Is it even possible to run programs built in Windows10 on Windows7 ? and if so what can I do?
Thanks
The default SDKs will be different on your two VS2017 installations. Right-click the project, select "properties", then the "General" page. See Windows SDK Version.
You can install different SDK versions (and different Platform Toolsets) using the Visual Studio installer ("Modify").
You would probably need to install the v140 toolset.
Also see the response here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/e19634d8-f635-4ed0-b8d7-45b64ccbd6fa/windows-sdk-7-in-visual-studio-2017?forum=visualstudiogeneral
...which states:
You can create a project with the default project template. After that, right click the project name under Solution Explorer and go to Configuration Properties-General, modify the 'Platform Toolset' to Windows7.1SDK, since you already installed the Windows SDK 7. Please have a look at the following note:
##To change the target platform toolset, you must have the associated version of Visual Studio or the Windows Platform SDK installed. For example, to target the Itanium platform with the Windows7.1SDK platform toolset, you must have Microsoft Windows SDK for Windows 7 and .NET Framework 4 SP1 installed
If the above not works, you can also modify the platform toolset to Visual Studio 2010 (v100), which has the same compiler like Windows SDK 7, if you have the VS 2010 and VS 2017 on the same computer

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.

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.

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