My app 'Qt' runs in my computer but does not run on my friend's - c++

I have a problem as I mentioned in the title, when I run it in my computer it's totally fine even if I moved the .exe file to another folder, but it cannot be run in my friend's, I tried to build it using 64bit and 86bit but still the same problem.
This is the error:
the application was unable to start correctly 0xc00007b
I've searched and found that it's because of the .dlls but how can I know which dll?
Edit: answering the question:
I'm using Qt 5.1.1 I built it statically , and my compiler is msvc11 86x.
problem:: Edit:
after assuming that my friend's windows has some problems since he really does have some problems , I installed a virtual one using virtualbox " windows 7 32bit " when I moved my app it really asked for msvcp110.dll and msvcr110.dll , but after downloading them from a website now it says:
the procedure entry point _crt create symbolic link w could not be
located in the dynamic link library msvcr110.dll
not sure should the files be from my windows or it's ok to download it from websites like dlls-files ?
Edit 3:
I solved it after deleting all the msvc dlls that I've downloaded manually when it asked , and I updated the windows and installed every version of the things that you guys listed and it works , but you need to delete the files that you've downloaded first otherwise it won't work.
thanks for all your help.

If you are dynamically linking to Qt, you should place Qt DLLs along the release version of your executable. These are Qt5Core.dll, Qt5Gui.dll and possibly the ones for other modules that you have used. These dll files are in your installed Qt Directory in bin folder.
You should also place msvcr110.dll and msvcp110.dll in case you are using MSVS2011. If you are using plugins you should place their dll in a folder named plugins beside your exe. In case of using icons and images you should ship their dlls like qico.dll and qsvg.dll in a folder named imageformats.

Related

Qt-Application Deployment doesn't work. Missing entry point and dll's

In the last months I created a project with the Qt-Creator version 4.7.0, Qt version 5.11.1 (open source version).
Now I tried to deploy it following the Qt doc and building the project with MSVC2017-64bit compiler as well as running windeployqt.exe afterwards on the generated executable.
As I tried to run the executable after the programm finished copying the neccessary dlls into the folder, a warning appeared:
The entry point ?
eventFilter#QAbstractItemView##MEAA_NPEAVQObject##PEAVQEvent###Z wasn't found in DLL "my/project/path/releasefolder/project.exe".
It seems to me like something was wrong with the Qt-Objects I use in my project, but I couldn't find anything, as it still worked flawlessly in the Qt-Creator.
A thought it might be due to the compiler having issues, so I changed it to mingw32, which I also tried to deploy the same way. But somehow in this case the warning disappeared, but many dlls were still missing even though windeployqt.exe should've already done that. And I also couldn't find them anywhere on my hard drive. I also tried a third compiler, but the issues weren't going away.
I searched online and only found people having problems with an entry point missing in a Qt dll or missing the Qt-Dlls in general, but haven't found anything related to my case.
I also tried Dependency Walker on every executable, but it found even more missing dll, which led me to believe the executables were somehow currupted so I tried it again and again, but with no success unfortunately.
Has someone any idea, why that could happen, or any suggestion for me?
Maybe I should change something in my project, even though it works fine in the IDE. I just need a way to deploy my Qt project in any way.
EDIT: Build using the Desktop Kit in Qt Creator with MSVC2017 the described warning appeared.
Build with Mingw32 (Desktop Kit) and with MSVC2017 using the UWP Kit in Qt Creator the following Dll was missing, that I haven't found anywhere on my hard drive: MSVCP140_APP.dll
EDIT2: I ended up downloading the required dll, to somehow get it to work, but it still didn't work. One build, that required that dll now started but immediately closes itself again and the other build was suddenly warning me of a missing procedure entry point.
EDIT [SOLUTION]: I let the Qt Creator create a whole new fresh project and copied all files from my old project in the new one. After that I only copied all the dll files into the folder and it worked.
Instead of relying on windeploy, manually add the dll. I am assuming you have built the project using mingw. Assuming you are using Qt 5.11.1, go to
C:\Qt\Qt5.11.1\5.11.1\\bin\ and copy all the dll files and paste in your executable folder. Also copy all directories from plugins folder (in /plugins) and paste in your folder. Now run the application, don't close the application. Now delete all the files from your executable folder. The one's not being used are deleted and the rest are left. I assume you are doing this on target computer. This might help.

Application failed to start because it could not find or load the QT platform plugin "windows"

I have looked through all of the questions that appear to be related on stack overflow, and none of the solutions seem to help me.
I am building a Qt application with this setup:
Windows 7 Professional x64
Visual Studio 2012
Qt 5.2.0 built with configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -platform win32-msvc2012 -no-opengl
Project uses QtSingleApplication (qt-solutions)
Application is a 32 bit application
qmake run with the following: -makefile -spec win32-msvc2012
.pri uses QMAKE_CXX += /D_USING_V110_SDK71_
I can build and run my program fine on my development machine (noted above); I can also install and run the package from Program Files directory on dev machine.
When I install and run on a Windows Vista machine (multiple machines)
VC++ redist 2012 11.0.61030.0 installed
VC++ redist 2010 10.0.40219 installed
plus 2005, 2008 versions of redist
(also fails on a clean install of Windows 7)
I get:
Application failed to start because it could not find or load the QT platform plugin "windows"
So I followed the instructions and added a .platforms/ directory, and added qwindows.dll (also added qminimal.dll and qoffscreen.dll); I also added libEGL.dll, libGLESv2.dll (even though I shouldn't need them I don't think)
Once I added qoffscreen.dll I now get the additional message: Available platform plugins are: offscreen
If I run through Dependency Walker I get this error listed:
GetProcAddress(0x76CA0000 [KERNEL32.DLL], "GetCurrentPackageId") called from "MSVCR110.DLL" at address 0x6AC6FDFA and returned NULL. Error: The specified procedure could not be found (127).
and then further down get the:
GetProcAddress(0x745A0000 [UXTHEME.DLL], "BufferedPaintUnInit") called from "COMCTL32.DLL" at address 0x745FFBF8 and returned 0x745AE18C.
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: offscreen.
Reinstalling the application may fix this problem.
Any ideas how to fix this dll issue?
The error is caused because the program can't find qwindows.dll
qwindows.dll has to be in a folder named platforms so that the path from your executable to the dll is platforms/qwindows.dll
Whereas this wasn't enough in my case. I had also to add following line at the beginning of my main()
QCoreApplication::addLibraryPath("./");
Then everything worked.
The application is able to run on the host system, since the Qt bin path is in the system PATH variable.
There is a standard Qt tool for deployment of Qt applications on Windows windeployqt to be able to run the application on target machines that do not have Qt installed.
That tool takes care about Qt DLL dependencies, makes a copy of platforms\qwindows.dll and also it makes a copy of libraries that you cannot detect with the Dependency Walker, since image plugins and some other DLLs are loaded at runtime.
You do not even need to have your Qt bin folder in your environment PATH. The simplest deployment:
copy built exe binary to a new folder
open cmd console in that folder
call windeployqt using the full path (if it is not in the system PATH) and provide your executable, for example:
c:\Qt\Qt5.2.1\5.2.1\msvc2010_opengl\bin\windeployqt.exe application.exe
As a result you have in that folder all needed Qt DLLs to run the application.
The tool windeployqt has various options. It can also take care about deployment of qml related files.
Of course you can have also issues with MSVC redistributables, but those should be deployed separately and installed once per system.
Only some 3rd party libraries should be copied manually if they are used, for example OpenSSL.
I got this issue and how I solved it:
Used dependency walker(http://www.dependencywalker.com/) to see the exact path of the dlls needed. Try it because both QtCreator and QT framework both have the same dlls and you must pinpoint the exact ones used.
I copied all dlls needed in the same folder as the app.
I have copied the folder platforms from QT framework /plugins and copied it in the same folder as the app. Now the app comtained also plugin/platform/ folder with all its dlls
And the most important step in my case is to create a file named qt.conf in the same folder as the app . This file should contain the path to the plugins. My qt.conf file contains:
[Paths]
Libraries=../lib/qtcreator
Plugins=plugins
Imports=imports
Qml2Imports=qml
I had the same issue "Application failed to start because it could not find or load the QT platform plugin "windows"
I fixed this by copying below files to the app.exe (my app executable) folder,
Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll and a "platforms" directory with qminimal.dll, qoffscreen.dll, qwindows.dll.
I hope this will help someone
Note this issue can also be caused if the search path for qwindows.dll that is encoded in your app includes the path where you installed Qt. Consider the following scenario:
I install Qt to c:\Qt\...
I develop an app and deploy it correctly somewhere else.
It runs on any computer properly because it includes qwindows.dll in a subdirectory.
I upgrade my local Qt to a new version.
I try to run my app again.
The result is this error, because the qwindows.dll in c:\Qt\... is found before the one in its local directory and it is incompatible with it. Very annoying.
A solution is to place a file qt.conf in the same directory as your exe file. I don't know how to avoid this. If you used the tool windeployqt.exe to deploy your app, so you have a subdirectory called platforms, then this is sufficient:
[Paths]
Plugins=.
For me, I needed to set QT_QPA_PLATFORM_PLUGIN_PATH to the platforms directory and then it worked.
For what it's worth, this solution was also mentioned on GitHub.
For the people who have this problem in the future - I have a dirty little hack, worked for me. Try at your own risk.
Follow all the steps in Initial deployment (Quick and dirty) [http://wiki.qt.io/Deploy_an_Application_on_Windows]
Close Qt Creator.
Copy the following into C:\Deployment\ The release version of MyApp.exe All the .dll files from
C:\Qt\5.2.1\mingw48_32\bin\ All the folders from
C:\Qt\5.2.1\mingw48_32\plugins\
(If you used QML) All the folders from C:\Qt\5.2.1\mingw48_32\qml\ Rename C:\Qt\ to C:\QtHidden\ (This turns your PC into a clean environment, just like one that doesn't have Qt installed).
Launch C:\Deployment\MyApp.exe.
Now for the hack -
Duplicate your folder for safety
If your file was in /cat/Deployment, go to /cat
Now, delete the Deployment folder while the .exe is still running.
It will tell you that it cannot delete certain files, so say Skip(or skip all)
What you're left with is the list of all the .dll files that your .exe was actually using and could not delete: the list of all the files and only the files that you need to keep.
You can close the .exe file now.
To check whether it is deploying okay, go into the folder where you installed it, say C:/Qt and rename it to C:/NotQt (basically make Qt invisible to the system).
If it works now, it will deploy on other systems more often than not.
Well I solved my issue, although I'm not sure what the difference is:
I copied every dll from my qt directory into both ./ and ./platforms of my application directory.
The application got past the error, but then crashed.
VERSION.dll was causing the crash (noted in dependency walker), so I removed it from both places.
The Application started up, so I systematically removed all unneeded dll's.
This got me back to the same state I had originally.
I then uninstalled my application and re-installed (with only the ./platforms/qwindows.dll file remaining), application works correctly.
So all I can assume is that I had an incorrect version of qwindows.dll in the platforms directory.
I got the same issue:
1. it can run in VS2010;
2. it can run in a folder with files as:
app.exe
\platforms\qwindows.dll
...
but it failed to load qwindows on a clean machine with same OS as the developing one.
Solved simply by move the platform folder to plugins:
app.exe
plugins\platforms\qwindows.dll
plus: qwindows.dll can be renamed as any you like as it is queried by an plugin interafce:
qt_plugin_query_metadata()
It's missing qwindows.dll, which normally should be in platforms, unless you add:
QCoreApplication::addLibraryPath("<yourpath>");
If you don't do this btw, and put your qwindows.dll somewhere else, Qt will search your PATH for the DLL, which may take a LOT of time (10s - several minutes)!
I fixed this by placing qt.conf in my application's exe folder:
[Paths]
Prefix=C:/Qt/Qt5.11.2/5.11.2/msvc2017
Where:
I have installed a custom Qt kit in C:\Qt\Qt5.11.2\5.11.2\msvc2017
qt.conf informs the app where the custom kit via the Prefix property. Note use forward slashes not backslashes (!)
And, optionally, the Qt kit's bin folder is included in my PATH environment variable
Defining Prefix in your qt.conf file allows it to find the qwindows.dll platform plugin when your app starts.
Tried all the above - turned out for me it was simply because I didn't have the main Qt dlls in the apps folder
Qt5Core.dll
Qt5Widgets.dll
etc
You need to add environmental variable QT_QPA_PLATFORM_PLUGIN_PATH to the system which points to the platforms directory in QT plugins. In my case, I was using Anaconda and PySide2. Therefore my directory path was C:\ProgramData\Anaconda3\envs\cv\Lib\site-packages\PySide2\plugins. This fixes the issue for every QT project. Otherwise, you have copy platforms directory to every QT project.

Can't start a Program because Qt5Cored.dll is missing

I compiled a simple Qt 5 project successful in Qt Creator. When run from within Qt Creator it works.
But when i transferred the executable into another location is produces the following error message on the cmd console;
The program can't start because Qt5Cored.dll is missing from your computer.
Try reinstalling the program to fix this program.
I tried to find Qt5Cored.dll in the Qt5 directory could not find. But strange thing is the program runs from Qt Creator. Any help please. I'm on windows 7 64 bit using Qt5 with MinGW
The file Qt5Cored.dll will exist on your system, otherwise it would not work from Qt Creator either. I think it's just Windows search that lets you down. Open a cmd prompt and do a dir c:\Qt5Cored.dll /s
Another note is that those *d.dll are debug DLL's, which means you are distributing a debug version of your application. You might want to build a release version for distribution instead. (In which case you'll need Qt5Core.dll)
On my computer the Qt5Core.dll and other .dll files are stored here C:\Qt\Qt5.9.1\5.9.1\xxx\bin (where xxx is the compiler version). Your Qt version may differ.
Copy the .dll files you want to the application location (where your .exe file is). These are the minimum .dll files I needed to copy for my basic app to work:
libgcc_s_dw2-1.dll
libstdc++-6.dll
libwinpthread-1.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
For me, it was located in this directory. (Qt Version : 5.11.2)
E:\Qute\5.11.2\mingw53_32\bin
On adding all the .dlls in the same dir. program worked.
For the solution what you need to do is to copy the path of the bin folder in your installed Qt creator. Mine was D:\QTCreator\5.12.10\mingw73_64\bin and then paste it in the Environment variable of your computer (which can be found in your advanced system settings of your PC)
Another option, instead copying .dll files to .exe folder, is to add the .dll location to the path environment.
I added the .dll path to user environment path in Windows 10 and worked.
Possibly problem is that RStudio does not behave well when quitting. Try restarting Windows to properly close the Qt5 libraries.
If you have installed Qt Creator you have the missing dlls. Mine were at C:\Qt\5.15.2\mingw81_64\bin. I added the path to my environmental variables and my executable now works. This solution allows you to move your application around without moving dlls.

Make exe file in QT-C++ missing qt5cored dll

When I copy project folder - was build and generate to bin folder - from my computer to anothers. It show "The program can't start because QT5core.dll is missing".
Will I install QT to another computer for get all of QT dll - It arround 2gb. I think it's not good solution. Because when I want to transfer it to customer. He will not like to install this software for just seeing program.
I tried to use NSIS but I don't know how to get dll from my machine. And what dll will I need for move to build folder.
Thanks for any solution from you.
May be your required dependencies not installed on target machine, do as following answer, it gets solved:
Qt 5.0 program runs in QtCreator but not outside
You don't need to install anything on the other computer. Just try going to the location where your Qt application is installed and then navigate to "..\Qt\mingw53_32\bin" directory. The search for the missing .dll files, copy them to the location where your .exe file is situated and then re-run the application.

Having trouble building Qt program

I created a Qt GUI application and I am trying to package it to share with other people. I built the package and used Dependency Walker to find all of the .dll files that I needed to include. After I put them all in the same directory as the .exe; I launched the .exe for the program and I got a message that another .dll was missing I included it. I was asked in the same way to add two more .dll files. After all the .dll's were included I launched the .exe and got this weird message.
I consulted Qt 5.0.2 documentation and I couldn't find any help. It works fine when I run it within Qt Creator.
I don't know what to do from here but any help would be great
Some things you could do to find out the problem:
Check if it behave the same way in debug and release mode. Note that the two modes need different DLLs.
Check if you are using the correct versions of the DLLs. If you installed different versions of Qt or other dependencies than there could be conflicts around DLLs that are the same but from different versions. Maybe you are in a kind of DLL Hell.
You should copy your program to another PC that doesn't have Qt installed. And watch if it works properly.