I am trying to port a Qt project that I have developed on Linux first. It is the first time that I'm experiencing building on Windows, and the fact that I could not solved the problem might come from a very obvious missing thing.
The Windows configurations I tried until now are the next one:
Windows 10 with Qt 5.8 MSVC 2015, Windows Kit 10, Qt Creator 4.5
Windows 7 SP1 with Qt 5.8 MSVC 2015, Windows Kit 10, Qt Creator 4.6
With both configs, I obtain an executable file that can be successfully run on the host machine, but when I deploy the application on freshly installed Windows 10, the application starts for few seconds and then stops(/crashes?). However, neither error messages, nor recoveries dialog, nor event log are showing up anything.
On freshly installed Windows 7 SP1, I get an error message saying that the entry point for CreateFile2 couldn't be find. I know that this function has been added since Windows 8, but I cannot understand why the application is built with such a entry point although I define the _WIN32_WINNT as follow in my .pro file:
DEFINES += "_WIN32_WINNT=0x0601"
I tried to the WINVER definition as well, without success:
DEFINES += "WINVER=0x0601"
I assumed no DLL were missing using a dependency software available at this git. I also tried the "more than depreciated" Dependency Walker, which didn't show missing libs.
By advance, thank you to the Windowsians who will save me!
Okay, I figured out that one of the static libraries my project is using, and that I compiled through VS 2017 was containing the CreateFile2 reference (using dumpbin.exe). I recompiled it using the right _WIN32_WINNT value, and also fresh-recompiled the Qt project. However, the CreateFile2 reference is still present.
Eventually, I found the problem!
The problem was coming from this external library I was building aside, and then linking to my final app in static mode. After rebuilding the external lib with the correct _WIN32_WINNT, it worked!
Hope this topic will help winnoob like me :)
Related
I have installed Qt-5.7 on windows 8 because I couldn't build my released .exe from Linux (my favorite) in order to be used on Windows OS even after searching a lot on internet (Where there have to be cross-compilation...). After the installation, I just want to make sure that I can build/run a first application (one of the examples provided by default by Qt-creator "filesystembrows") and I have follow the official guide in order to build Qt as shared libraries, but the issue is that when I type the first command line I get: 'nmake' is not recognized as an internal or external command' Also it still show the same message even though a update the variable environment of the system with C:\Qt\Qt5.7.0\5.7\mingw53_32\bin which one is the default path set-up when installing Qt on windows. Any help just to make a stand alone .exe for Windows (as shared libraries ) please
Why not build your project by using qtcreator ?
Did you test your build environnement by making a test application with qtcreator ?
P.S.: If you want, I can explain how to build application using Visual Studio as a compiler and QtCreator as an IDE.
nmake is a build tool provided with Visual Studio and with Windows SDK. You don't have it, apparently.
It seems you're using a mingw build of Qt; it comes with a bundled copy of mingw. There, the build tool is simply called make.
I try to deploy a Qt app on a basic Windows 7 Pro SP1 machine.
My app works fine when I run it inside Qt Creator or on any machine with Qt insllated.
I have read a lot of posts and try many different things without success.
Things tried :
Windeploy Qt
Quick and dirty method of Qt Wiki
Add mingwm10.dll
Add libEGL.dll
Check loaded dll with dependency walker
Check loaded dll with Qt Creator debugger
My app crashes when I run it with these two error messages :
This application failed to start because it could not find or load the Qt platform plugin "windows".
This application has requested the runtime to terminate it in an unsual way. Please contact...
This is my current tree (obtained with windeployqt) :
*.exe
*.dll
platforms/qwindows.dll
imageformats/*.dll
iconengines/*.dll
With dependency walker, I have some red lines even if the app runs normally but nothing interesting.
Dev machine info :
Windows 7 Pro Sp1 64 Bits
Qt Creator 3.3.0
MinGW 4.9.1 32 Bits
Qt SDK 5.4.0
I'm probably doing something wrong but what ?!
The executable seems to search something in the Qt base directory because when I rename it the deployed app doesn't want to work anymore.
Need help please ;)
Ok, I found the solution...
I added this line at the very beginning of my main function :
QApplication::addLibraryPath("./");
After that, windeployqt does the job.
I hope it will help someone in the future.
I'm deploying my QT project to a windows machine and everything worked fine.
Yesterday I add Qwt library to my project and when I deploy it the executable won't start giving this error (On QtCreator everything works fine)
The procedure entry point ?staticMetaObject#QGraphicsEffect##2UQMetaObject##B could not be located in the dynamic link library Qt5Widgets.dll
I think I included all the needed library.
I've tried to use windeployqt,
I've included
DEFINES += QWT_DLL
on the top of my .pro file as read here
but it still give me that error.
Maybe I miss some dependent dll.
Do you have any idea on how to resolve this?
I had the same issue.
I couldn't understand it with dependency walker, as even working apps showed missing dlls.
I used qwt in my program and compiled it in Qt 5.5 with MSVC2013 32bit on a 64bit Windows 10.
After changing 'Qt' folder name to 'QtHidden', as sugested here, I attempted to get the application to run with all the dlls in the same folder and was getting an weird error about qwt like you, althouth I had added qwt.dll.
To get it working I did the following:
Copied all dlls in QtHidden/5.5/mingw492_32/bin to my deploying folder
I copied all folders in QtHidden/5.5/mingw492_32/plugins
Copied all folders in QtHidden/5.5/mingw492_32/qml
// Pretty standard untill now
added qwt.dll
// Now for the trick
Performed the steps 1,2,3 but for the folder QtHidden/5.5/msvc2013, overwriting all dlls and folders previously added from /mingw492_32.
So, what I believe is happening is that some dlls from mingw are needed, like libgcc_s_dw2-1.dll and libstdc++-6.dll, but all other dlls need to come from the MSVC2013 folder for qwt to work, wich was the compiler used.
I managed to run it in Windows Xp 32bit after adding MSVCP120.dll and MSVCR120.dll. Still needed this extra ones because MSVC2013 wasn't installed in the Windows Xp computer.
Compiled in Windows 10 with all resources and ran on Windows Xp. I'd call it a success.
Hope it helps someone else.
I downloaded and installed Qt 5 on Windows 7.
I opened QtCreator 2.6.1 and created a new simple GUI application.
When I try to run it, it says:
“C:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore\qglobal.h:46: error:
C1083: Cannot open include file: ‘stddef.h’: No such file or
directory”
What is the problem and how do I solve it?
My compiler is: MSVC2010 32 bit
A google search yielded the following:
http://qt-project.org/forums/viewthread/10255
This thread notes that this error happens when you don't have the Microsoft Platform SDK installed and you are using Visual Studio. That would make sense considering that stddef.h is one of the standard headers (usually its included using <cstddef>, but looking at the source for qtcore/global.h it would seem that it is indeed included as <stddef.h>). So, try installing the platform SDK if it isn't already there.
If you already do have the sdk, perhaps it isn't configured properly. This answer says you need to follow the instructions given by microsoft here to do command line builds properly. I think Qt Creator probably executes the compiler from the command line, so that may help.
If that still doesn't work, try installing the MinGW compiler and using that. I have seen a few references saying that its easier to compile for Qt under windows using MinGW.
I've been using the CppShellExtContextMenuHandler sample project from Microsoft's All-In-One framework to add a custom menu item + icon to windows's context menu.
However, it seems that I can't register the DLL provided by this sample on other computers than mine. The DLL, compiled on a Windows 7 x86 machine from unmodified code, doesn't run on:
Another Windows 7 x86
A fresh Windows XP SP3 x86 install on VirtualBox
I get:
LoadLibrary(CppShellExtContextMenuHandler.dll) Failed to find
specified procedure
(translated) on the XP machine
The module "CppShellExtContextMenuHandler.dll"
failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.
The specified module could not be found
on the other Windows 7 machine
I use Regsvr32 CppShellExtContextMenuHandler.dll in the commandline to register the DLL.
Did anyone encounter this problem? Did I miss something (dependencies/project config)?
I'm not sure how to debug this one.
Thank you for your help!
PS1: Code is available here: http://1code.codeplex.com/releases/view/71395, under ./Visual Studio 2010/CppShellExtContextMenuHandler in the package.
PS2: Compiled version of the sample is here: https://fgt.bo/GmQ
Finally found the answer, thanks to Choosing a Deployment Method on MSDN.
To make the DLL file compiled from the CppShellExtContextMenuHandler sample work on non-dev computers, you need to accompany it with the VC++ Runtime DLLs it depends on.
I used the wonderful tool on a client's (non-dev) machine to get the name of the DLLs my context menu handler depended on (the tool indicates which of them are missing on the arget computer!).
It turned out I had to redistribute the msvcr100.dll and msvcp100.dll files from [Program Files\Microsoft Visual Studio 10.0\VC\Redist] along with the CppShellExtContextMenuHandler.dll file to make it work.
To make the handler work on Windows XP, I also had to replace the two occurences of
hr = HRESULT_FROM_WIN32(RegDeleteTree(...
by:
hr = SHDeleteKey(...
...in the Reg.cpp file. In fact, according to C++ Windows Shell context menu handler Sample, the RegDeleteTree function isn't available on XP.
The SHDeleteKey is equivalent and can be found in Shlwapi.h, on all versions of windows I tested.
Thank you for your time reading and trying to solve this!