QT Creator cannot find "objbase.h" when invoking nmake - qt

When attempting to build my Qt project with MSVC2015 64bit for Windows 10, I get this error:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Ole2.h:37: error: C1083: Cannot open include file: 'objbase.h': No such file or directory
...
NMAKE:-1: error: U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.EXE"' : return code '0x2'
NMAKE:-1: error: U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
-- when nmake is invoked during the build process.
This exact same error also occurs for the example project "addressbook".
It appears to be some kind of toolchain issue, but I can compile a Qt Widget project in Microsoft Visual Studio 2022 if I point VS at my Qt installation.
I'm not sure what I need to do from here, since I already tried a reinstall of Qt. I have seen that putting things in Program Files is generally a bad idea, but that doesn't seem to be the issue in this specific case.
It appears to be part of the Windows SDK, if Google leads me right. However, I did not have to download the Windows SDK separately in order to compile my project and run it successfully before. (For context, the project's been developed for a few months and this problem only emerged a week or so ago).
My QT Installation:
Kit: Desktop Qt 5.15.2 MSVC2015 64bit
Version: Qt 5.15.2 MSVC2015 64bit
Compiler: Microsoft Visual C++ Compiler 17.3.32811.315 (amd64)
Things That Have Happened Before My Build Attempt:
I recently reinstalled Qt 5.15.2 in an effort to resolve a similar missing file issue.
The company's recently had issues with Microsoft Intune deleting applications. Maybe it hit the Windows SDK too.
Attempts at Solving the Issue
Reinstallation of Qt 5.15.2
Expected: My project building without errors. Result: This error.
Search of file system for objbase.h
Expected: Finding the file. Result: I did not find the file.
I'm newish at Qt, so I didn't want to try anything more esoteric lest I made things worse than before.
Update: MinGW 64 bit works for the example Qt projects, but I'd still like to use MSVC2015 if possible. It doesn't work for my project because I use some MSVC specific pre-processor flags in my source.
Update 2: I attempted to re-download MSVC 2015 from Visual Studio's website, using their Build Tools installer. While the installation successfully finished, I got no change from before -- it still can't find that "objbase.h" file. It's supposed to be in the Windows Kits directory under Include//um , I think.

It appears that, in my case, the objbase.h file was deleted due to the issue with Windows Defender deleting random files. I was able to reinstall the version of Windows SDK that was using and this fixed the issue for me.

I figured it out. I'm posting the solution here for others.
My issue was that, for reasons that are unclear to me, VS Studio Build Tools would not actually remove the SDK in question if I unchecked its box in the Modify screen. You can tell if this is happening by checking the disk size difference of the upcoming installation in the lower right of the screen -- if it won't remove the SDK, that size will be +0 bytes (assuming you don't check or uncheck any other box).
In order to properly reinstall the SDK version, I had to go to "Add or remove programs" and find the SDK there, uninstall it, restart my computer just for safety, and then go to VS Build Tools and install that SDK version. I had to do a "fake" uninstall with VS Build Tools (basically, uncheck the now-deleted SDK and click "Modify", allowing it to do the installation and download steps) before I could actually install the SDK again.

Related

Installed Qt5.15 LTS (5.15.7), debug DLLs missing/not installed

I used the online installer to install Qt 5.15.7.
Running my application in Release mode from Qt Creator worked fine.
When I attempted to run it in Debug mode, I get the following System Error dialog:
I searched my bin directory (C:\Qt\5.15.7\mingw81_32\bin) for Qt5Cored.dll, but it's completely missing any and all DLL files:
Does anyone know where/how to install the debug dll files for Qt?
There is a chance that they are not available for non-commercial license, although if you have it just look for debug symbols in Qt installer as they might be distributed separatelly.

Installing a compiler for Qt4.8.7 on Windows10

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.

make qt5.3.1 .pro file from Visual Studio 2013 project

I wrote a little Qt utility in VS2013. It works fine when running from IDE - even debugging is great. But VS doesn't generate usable exe (error 0xc000007b - "The application was unable start to work correctly", after I've installed all required qt's dll's).
Is there any way to compile everything and correctly from VS? To make really runnable exe?
Or - How can I write correct pro file for qmake?
I tried to write some. qmake generated from it makefile without any erros, but running VS's nmake it gives a "fatal error: U1077 return code '0x2'".
As I think it is problem with linker - even I wrote for all used modules all required QT += lines.
Can anybody help? I think I'm not alone who met this problem.
Thanks.
When you get an error like you got it means you have some dlls missing. You can only find out what dlls are missing using DependencyWalker.
*.pro files can be generated from Visual Studion using the Visual Studio Add-in for Qt4 or with Visual Studio Add-in for Qt5 depending on your Qt version.
If you have a Qt/VS application you want to deploy, AFAIK the following dlls are needed:
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
platforms (folder)
qminimal.dll
qoffscreen.dll
qwindows.dll
icuin52.dll
icudt52.dll
icuuc52.dll
YourApplication.exe
For more information see http://qt-project.org/doc/qt-4.8/deployment-windows.html

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.

Can you install Qt-4.6.0-wince successfully?

I'm trying to install Qt-4.6.0-wince on XP and Vista. I read the instructions and follow it to install.
However, I can't install it successfully due to some fatal errors on all of the two machines. I think the problem is that qconfig.[h cpp] files are not created automatically during the configuration.
I already report about this problem, so you can see the more information here. However, it is still remained as unresolved.
Anybody here who has been installed it successfully?
#KernelJ I believe the original poster is using the correct install distro - the final product will be cross compiled from Win32 to WinCE; as is pointed out in the Qt for Windows CE Requirements.
#Brian, Unfortunately, I can't answer your original question - I have had unrelated trouble with the WinCE distribution myself and am working the issues now. However, I can provide some help: I was able to get the Qt Everywhere 4.6 to cross compile on my Win32 (XP) host for WinCE. I used the commercial version, but here is a link to the Open Source Qt Everywhere 4.6 package. As is pointed out in the nokia instructions, make sure to use the Visual Studio command prompt, get your environment variables ironed out, create a custom mkspec (if you have to), and keep a close eye during the configuration for any warnings.
Good luck.
Qt-4.6.0-wince, as is implied in the name and said explictly on the page you linked, is for Windows CE, NOT for Windows XP and Vista!!!
Nokia have released a nice software development kit for Qt which you can download here. It is very impressive and powerful!
I got things running as compilable (and running on emulator) with VS 2008, so your milage may vary:
Make sure the PATH variable points to \bin
Open a command prompt (using the Visual Studio Command Prompt)
Run the vcvars32.bat file (in C:\Program Files\Microsoft Visual Studio 9\VC\bin) folder
Cd into the qt folder
Run this: configure -no-sql-sqlite -no-qt3support -platform win32-msvc2008 –xplatform wincewm50pocket-msvc2008 -no-phonon -no-phonon-backend -no-webkit (building for WINCE 5.0, and all the '-no-...' makes it build faster, removing stuff we don’t want)
The setccepaths script provided sometimes doesn’t work. I used checksdk.exe –script temp_script.bat (It creates a script, the default is for Pocket PC SDK 5)
Run that script you just created (the temp_script.bat thing. It sets up environment variables.
Run nmake
*whew*
and good luck.

Resources