问题
After switch to release mode to build a small project I have, when I try run it from inside the qt-creator ide, all goes fine. But when I go to the folder build-<project_name>-Desktop_Qt_5_14_1_MinGW_64_bit- Release
and try run the executable generated in this directory, I got this error:
Anyone knows what the problem here? If it was some missing dll, I supose it will specify what dll was missing, right? Or I am mistaken?
update
After run windeployqt
, this command found dependencies for my application, create some folders, but now I am getting tis error when try to run it:
update 2
after run the utilitary dependency walker
, i got this errors on it:
I am using this build kit to build the project in qt-creator:
回答1:
Here is all I know about Qt deployment & issues on Windows.
- Check whether Release configuration of your project doesn't contain links to any debug versions of libraries.
- Build your app in Release mode. Use Rebuild, If in doubt. See compile output window in the IDE, what paths it actually uses.
- Use windeployqt tool to automatically copy all the necessary Qt dlls to the executable's folder. Be sure you are using windeployqt.exe from the correct folder. For example, currently I have one version of Qt framework, but two versions of windeployqt: for x86 and x64 compilers. In the case you have more than one version of Qt installed, you may have several versions of the tool.
.
C:\Qt\Qt5.14.1\5.14.1\msvc2017\bin\windeployqt.exe
C:\Qt\Qt5.14.1\5.14.1\msvc2017_64\bin\windeployqt.exe
Copy compiler libraries to the release folder. Make sure that you're copying libraries from the exact compiler you used to build.
Copy all necessary additional 3-rd party dynamic libraries. Make sure it is not debug versions.
If the problem persists, press
Ctrl+C
when the error message is active. It will copy all the text from the message box. Paste main part of the message to Google.If the problem persists, open your .exe file in some dll-dependency viewer. Here is how I can see this in Lister. Be note that such a tool will show you not only missing dlls, but also a full path for each dll that your executable actually use. More power tool is Dependency Walker.
Make sure your application doesn't try to write something to a system protected folder, such as
c:\Program Files\
, without corresponding privileges.If the problem still persists, simplify your project as much as possible. Run Release for an empty project. Than add modules, functionality and libraries step-by-step.
If everything is okay, test the application on a completely clean virtual machine.
Edit. I google your error text and what I found:
https://android.developreference.com/article/11361766/Qt5+deployment+%E2%80%9Cprocedure+entry+point+could+not+be+located%E2%80%9D
The problem was that windeployqt was unable to locate gcc for some reason. I added it to my path from cmd with SET PATH=%PATH%;C:\Qt\Tools\mingw530_32\bin. After I ran windeployqt again, I did not have to copy libgcc_s_dw2-1.dll and libwinpthread-1.dll over manually and it used the correct Qt5Core.dll, since the application is now working fine.
Edit2. Excess item removed.
来源:https://stackoverflow.com/questions/60914375/unable-to-run-qt-creator-executable-outside-ide-compiled-in-release-mode