Installing a compiler for Qt4.8.7 on Windows10 - qt

I am trying to install Qt4.8.7 for Windows 10 and I am having some issues with installing the corresponding compiler.
I got the Qt4.8.7 installer from this link: https://download.qt.io/archive/qt/4.8/4.8.7/ and I have tried working with the MSVC2010 and the mingw versions. For the MSVC2010 version, I followed this guide https://wiki.qt.io/How_to_setup_MSVC2010 (with a lot of dead links) and installed the compiler alongside the MSVC service pack 1 and Windows SDK 7.1. I have not been able to find an installer for Visual Studio 2010 or the VS service pack 1. Qt studio recognises the version of qt I have installed alongside the corresponding MSVC2010 x86 compiler but when I compile I get this error for a missing header: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\intrin.h:26: error: C1083: Cannot open include file: 'ammintrin.h': No such file or directory".
For the mingw version, I have not been able to find the correct version "mingw482" and other versions I have tried do not seem to be compatible. I have tried mingw installer programs as well as using the QT online installer to try and find the correct version but I haven't had much luck when compiling.
Has anyone got qt4.8.7 running on windows recently? If so, could you please point me in the right direction for installing the correct compiler?
Many thanks.

Here a short description for getting it to work with Visual Studio 2008 and the newest Qt Creator 4.13.
You will need:
Visual Studio 2008 Express for the build tools, there are no standalone build tools as far as I'm aware
Qt 4.8.7 precompiled for VS2008 from this link to Qt archives at the time of writing this the version you need is called "qt-opensource-windows-x86-vs2008-4.8.7.exe"
Any Windows debugger cdb.exe
Steps (all absolute paths are standard installation paths):
Install VS2008
Install Qt 4.8.7
Open your Qt Creator go to Tools->Options...->Kits->Tab Compilers and search for "Microsoft Visual C++ Compiler 9.0", it probably won't be there so you will need to add it by hand by looking for the vcvarsall.bat of this compiler. You will find it in C:/Program Files(x86)/Microsoft Visual Studio 9.0/VC/vcvarsall.bat. Repeat for C, C++, x86 and x64. Press save
Open the Qt-Versions tab and look for Qt 4.8.7 Version. It will probably not be there again so add it by hand by selecting the qmake.exe from C:/Qt/4.8.7/bin/qmake.exe. Press save
Open the Kits tab and add a new kit. Select your Qt 4.8.7 version and the MS compilers for C and C++, your favorite debugger and input the Qt-makespec win32-msvc2008. Press save again
Now you should be able to compile your project from Qt Creator and Qt-colored-commandline. For integration of MSVC 9.0 into Visual Studio 2015 and newer you will also need to install Visual Studio 2012 Express. In that order:
VS2008
VS2012 (Here MS programmed in some magic so newer VS can see older build tools)
VS201x
It could work in any other order but don't rely on it. Also it could just flat out not work and you will waste a week of your life to fix it; but then it will work.
Haven't tested it but I could imagine the same workflow will work for VS2010.

Related

Cannot run Qt example in Qt creator: The program has unexpectedly finished

Recently I tried to upgrade Qt to 5.8.0 on Windows 7 32bit from Qt5.6.2 MSVC 2013, and I saw strange issues.
I downloaded and installed Visual Studio 2015 from this link: https://www.visualstudio.com/downloads/
After I installed Qt 5.8.0 MSVC 2015 version, Qt Creator 4.2.1 can be launched. From the welcome page, I selected the example named: "Address Book Example". And then after clicking "Configure" project, the project is listed in Qt Creator.
Now I tried to build the project, which was successful. But when I tried to run the project, I got the following error messages:
Starting C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe...
The program has unexpectedly finished.
C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe crashed.
I didn't see this kind of error before when I was using Qt5.6.2 with MSVC 2013. I also tried the following things:
Reinstall Qt5.8.0 MSVC 2015 using offline installer
Reinstall Qt5.7.1 MSVC 2015 using offline installer
Reinstall Qt5.6.2 MSVC 2015 using offline installer
Reinstall Qt5.8.0 using online installer, in which I chose MSVC 2013 and MSVC 2015
I still kept getting the same error messages.
When I went to the debug folder, double clicked the exe file, it said some Qt dlls were missing. I then manually copied to the debug folder, then the exe can be run with no problem.
Now I want to run app from inside Qt Creator, but not sure what is the issue with Qt Creator 4.2.1. I researched in Google for a few hours, but still cannot find out the reason why Qt Creator cannot run projects even it's own Example projects. (same errors for my own projects)
I feel it must be something to do with Qt creator environment/settings. Anyone has any ideas about this problem?
Update 1:
I tried to use MinGW with Qt Creator, the addressbook example can be run correctly. Looks like it's related to MSVC 2015. I need MSVC 2015, because all other environments don't support webenginewidgets, and I got:
:-1: error: Unknown module(s) in QT: webenginewidgets
Not sure if this is a bug in Qt or Qt creator.
Update 2:
In my Qt Creator, I saw warning icons for MSVC 2013 and MSVC 2015 compilers, please see the screenshots below:
I finally resolved the issue. The reason is that the Windows 10 SDK is missing.
After I download and install all default components of the Windows 10 SDK, everything worked on Windows 7 32bit.
Basically, to make sure we can use Qt5.8.0+ on Windows (including Qt WebEngine), we need to install both:
Visual Studio 2015, and
Windows 10 SDK
I'm late but I've found the main culprit is "ucrtbased.dll".
I didn’t install Windows 10 SDK.
I'm on Windows 7 SP1 x64, Qt 5.9.2 with Visual Studio Build Tools 2015 (v14.0.25420.1) and Windows 8.1 SDK with MS Debugger Tools (CDB) installed. The Release Configuration builds are without any issue but the Debug Configuration exhibits the same crash behavior. The fix is simple. The normal install of Visual Studio Build Tools 2015 with Win8.1 SDK places "ucrtbased.dll" in "C:\Program Files (x86)\Windows Kits\10\bin\x64\ucrt" for 64-bit and "..\x86\ucrt" for 32-bit builds - even the Windows 10 SDK is not installed. If these are included in system path, or copied to the Qt's current project build folder, the issue is simply resolved.

Installation of Qt 5.6.1 MSVC 2015 Update 3

I have encountered the following problem during a routine Qt 5 installation combined with Visual Studio 2015:
I did these steps:
Installed visual studio 2015 enterprise
Updated it to Update 3 (recent)
Installed X64 Debuggers And Tools-x64_en-us + 32bit
Installed Qt 5.6
I inspected the automatic detection of compiler, debuggers and the build environment comparing it to another machine, and all look OK.
Created new test projects using empty console application, Qt quick.
All fail during compilation step, with exactly 20 errors:
20 compile errors
I noted that the errors appears in code files of VC++ include path
for example in the code file xtr1common (first error in the picture).
I installed and used Qt with MSVC including MSVC Update 2 many times before but not with Update 3. What went wrong? How do I fix the problem?
Just go to windows updates and remove the visual studio update 3. This will return visual studio to original status including the C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE folder.
I hope there is a better answer than this because I needed the visual studio update 3 for other purposes than Qt. But what to do if the Qt 5.6.1 is not compatible with Visual Studio 2015 update 3. If someone have a better answer please hit me.

How to fix QT VS Add-in for Qt 5.6 beta and VS2015?

I did not compile Qt myself, rather I used installer from official Qt website (5.6 beta is available since few days ago). Installation was successful, Qt folder conatins bin folder with qmake and everything. Building apps in Qt Creator works.
However, when I try to launch Qt using VS addin 1.2.5.9 I get error
No default Qt version found. Pleae check your Qt Visual Studio Add-in
settings.
I have edited QT5 -> Qt Options to contain the correct Qt path to 5.6 beta, error still persists.
I have also added QTDIR into Path in Windows 10.
I am using Community Edition of Visual Studio 2015
How to fix this? Create new Qt project under VS fails as well.
The Qt Visual Studio add-in is no longer supported in Visual Studio 2015.
Microsoft decided to deprecate AddIn support in Visual Studio 2013 and with Visual Studio 2015 all support for it has been removed. This is covered in https://bugreports.qt.io/browse/QTVSADDINBUG-404. However, there's an extension called Qt5Package you can install instead.
I found when I tried to add Qt 5.6.0 Beta in the extension I got the error "This Qt version uses an unsupported makefile generator (used: MSVC.NETMSBUILD, supported: MSVC.NET, MSBUILD)". The workaround is in C:\Qt\Qt5.6.0\5.6\msvc2015\mkspecs\common\msvc-desktop.conf Qt 5.6.0 splits all the version-specific changes into a separate file msvc-base.conf. If you copy the contents of this file and replace the line "include(msvc- base.conf)" in mscv-desktop.conf then Qt5Package recognises the Qt 5.6.0 Beta with no problems.
Note this still needs to be fixed in Qt5Package.

Qt in Visual Studio 2012, "error C1083: Cannot open include file: 'stddef.h': No such file or directory"

I errors and a warning when I try to compile some openGL projects for Qt.
Many of them are:
error C1083: Cannot open include file: 'stddef.h': No such file or directory d:\documents\code\qt5pack\qt-everywhere-opensource-src-5.0.1\qtbase\src\corelib\global\qglobal.h 46 1 01-createcontext
Using Qt and OpenGL with Visual Studio or Creator is giving me a headache. I noticed that my $VCInstallDir is to VC10.. I don't know if that is anything important.
I had this exact problem and struggled with it for a few days. My situation was this:
Had VSE 2013 installed, Qt 5.3.1 (64 bit), and OpenCV 2.4.9 (64 bit). Was working fine, building projects in QtCreator + OpenCV using the VS 2013 compiler. Then I was trying to incorporate CUDA and found that the CUDA compiler was not compatible with VS 2013 so had to downgrade to 2012. That's when the problem started. Tried repairing, uninstalling, reinstalling...nothing seemed to work. I kept reading in posts that it probably had something to do with the Microsoft Platform SDK not being installed or installed correctly. So I went to this site to download a fresh copy and noticed that down the page there was a section that described how to uninstall it, including some manual steps.
http://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx
So, here's what I did to get everything working. Maybe all these steps were not required, but this is what I did.
1) uninstall VSE 2012 (I had already gotten rid of VSE 2013), and deleted the folders C:\Program Files (x86)\Microsoft Visual Studio 11.0 and C:\Program Files (x86)\Microsoft Visual Studio 10.0 which both had some residual stuff in them after the uninstall. NOTE: Remember that VS 2012 is really Visual Studio 11.0 and VS 2010 is Visual Studio 10.0.
2) uninstall all Microsoft .NET Framework SDKs (there were a few on my machine 4.5 and 4.51)
3) uninstall all Microsoft .NET Framework Multi-Targeting Packs, which apparently is part of the SDK. Again, there were several on my machine...I guess from different versions.
4) reinstall VSE 2012
5) reinstall the Microsoft SDK. For me this was the latest version 8.1 which works for Windows 7, 8, and 8.1.
6) made sure all my kits were right in QtCreator, which they were, and it all worked again.
Hope this helps someone.
Now I can get back to re-compiling OpenCV with all the NVidia/GPU options. :-)
VS2012 should actually point to VC11...
Have you checked your projects properties? Have you installed the Windows SDK?
I am very new to building, making and configuring projects and compiling from source. I don't know what exactly was wrong, but I think it might have had to do with the VS2010 express installation I did earlier this month. I "repaired" VS2012 using the uninstaller and now it seems to work.

Installing and compiling using the Qt Creator

So I thought upgrading Qt and Qt Creator was a good idea since I used an older version of both.
I re-installed everything as I should and realized that Qt 5 is only for VS2010 for Windows which I have never worked with since I have been sticking with minGW up to this point,
I then realized my problems that my project wouldn't compile and run so I tried to download the 4.8.4 version with minGW, but that complained that:
"The installer could not find a valid c:\MinGW32\include\w32api.h
(Only versions with W32API3.13 are supported)"
and further I did not get creator when I installed it either.
Any help that would either let me go back to 4.8.8 minGW or a simple straight forward way using Qt creator with VS2010 would be appreciated, thanks.
I think I solved parts of my own issue (at least enough to answer this problem).
1: Download and install latest minGW installer and add ';C:\MinGW\bin' to the system variable 'path'.
2: Download the Qt 4.8.4 and install it (Does not come with Qt Creator) and add'C:\Qt\4.8.4\bin' to the system variable 'path'.
3: Download the latest Qt Creator, launch it and go:
tools -> options -> build & run
From there choose the correct Qt version by pointing to the Qmake in the Bin folder (C:\Qt\4.8.4\bin in this case)
Also make sure it auto detects minGW compiler, if it does not show up I am not sure what to do.
4: If you are including a project from other Qt versions you might have to delete the users.pro file (not the .pro file) to get it to compile properly.
Last issue is that I do not have any debugger, but the program compiles in the /release folder (if you put CONFIG += release in the pro file) and I can run it by using the .exe.
Using MSVS 2010 as the compiler isn't too hard.
Download Visual Studio Express 2010.
Install it, and now you have MSVS 2010 compiler available.
The compiler should be located under C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin or somewhere similar at cl.exe.
Setting up the latest version of Qt built against MSVC 2010, with the latest Qt Creator isn't too bad, either. In Tools > Options > Build and Run > Kits, find your Qt qmake installation, and in Tools > Options > Build and Run > Compiler, find your compiler.
Now you can use the amazing Qt 5 instead of sticking in the past with 4.8 (even though Qt 4.8 is awesome and works really well, too).
Hope that helps.

Resources