Qt creator won't run app after compiling - qt

I checked out a Qt project hosted on google code with SVN to a local folder. When I opened it on Qt Creator, it managed to compile the project, but when it tried to run the compiled program, an error message came up on the application output:
The process could not be started!
What is wrong?

I solved this problem by going to projects>run settings and manually specifying the executable. Found this solution by googling, don't know if it's the proper way to fix this.

I assume you tried to run it manually and not from the IDE by pressing Ctrl+R, and I assume that it works when you're running it from the IDE. If that's the case, the problem is that the compiled application requires the Qt libraries and the runtime loader can't find them. When deploying the app, you need to copy the Qt libraries it links against to the application folder (on Windows), or you need to copy them to the app directory and launch it via a wrapper script which adds that directory to LD_LIBRARY_PATH (on Linux.)

Related

Unable to run qt-creator executable outside ide compiled in release mode

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:
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://stackoverflow.com/a/52127944/
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.

Run qt qml app on another pc

I wrote some app in Qt 5.7.1 with Qml Quick 2.6.
It does not run on another pc where Qt does not install.
In logs I see this error:
"[WRN] QQmlComponent: Component is not ready".
In Windows's Task Manager I see app is running, but there is no window of app.
All qml files I put in resourse file.
new QQmlComponent(&(this->engine),
QUrl(QStringLiteral("qrc:/qml/design/qml/main.qml")));
Dirs with app looks:
When I start app on another PC, there are no any message with errors about depence of some dlls. Please help...
Getting the correct (and minimal) set of DLL binaries copied over to the target machine isn't the easiest thing. But there's standard documentation for it and a helper tool called windeployqt that you should check out.
http://doc.qt.io/qt-5/windows-deployment.html

Deploying Qt C++ Application from Visual Studio qwindows.dll error

I've been googling for a solution to this issue and although I've found many people sharing my problem none of their solutions work for me.
I wrote a C++ application using Qt framework using Visual Studio 2010. I built and ran the application in "Release" mode from Visual Studio without issue, but when I copy that exe from the Release folder to a new destination (pretend its a new PC) it fails to run providing this error:
---------------------------
TestApplication
---------------------------
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: windows.
Reinstalling the application may fix this problem.
Within the executable directory I have the following file structure:
./TestApplication.exe
./libGLESv2.dll
./Qt5Core.dll
./Qt5Gui.dll
./QtWidgets.dll
./platforms/qwindows.dll
./qt.conf
All dll files were taken from the 5.0.0 build of Qt in the Qtbase folder where the libraries reside.
The qt.conf file is:
[Paths]
Plugins=.
Without it, the launch error is the same except it says "minimal" and "offscreen" are available platforms as well.
For all other people experiencing this error it seemed to be solved by creating the platforms folder and putting in the qwindows.dll. But doing that myself doesn't change any behavior.
Is there something I've done wrong? Perhaps my method of generating the .exe in the first place is wrong?
If you are using libGLESv2.dll, then you must include libEGL.dll, too.
You can't see that in depends.exe, don't know how the Qt developers managed to hide this.
If your Qt is out of the box, then both Dlls are necessary even if you are not using OpenGL.
Also, if your Qt is out of the box, you need to include also the three ic*.dll, which contain information for Unicode handling.
You can see which DLLs are needed by looking at which ones are invoked when running Debug (F5) in Qt Creator.
=Carl
The release is likely missing a library/plugin or the library is in the wrong directory and or from the wrong directory.
Qt intended answer: Use windeployqt.
Qt comes with platform console applications that will add all dependencies (including ones like qwindows.dll and libEGL.dll) into the folder of your deployed executable. This is the intended way to deploy your application, so you do not miss any libraries (which is the main issue with all of these answers). The application for windows is called windeployqt. There is likely a deployment console app for each OS.

Can't start QT .exe file on Windows 7

I'm getting started with Qt and have encountered the following issue: when i compile and run my application from within QtCreator it runs all right, but when i go to the debug folder and double click .exe file to launch the app a message box pops up and it says
This application has failed to start because QtDeclaratived4.dll was not found. Re-installing the application may fix this problem
Please notice - it is QtDeclaratived4.dll with letter d before 4, not QtDeclarative4.dll.
After searching in Google i found an advice to find the needed dll and put it inside project folder. But unfortunately such .dll is missing on my computer. I found QtDeclarative4.dll and tried putting it inside project folder but it didn't help. Can you propose me any other solution?
The d in the name indicates the debug version of Qt, which means that you compiled your application using the debug build.
You probably have this DLL on your computer and Qt Creator knows where it is, that's why it is able to run your application. However, you don't have the path to this library configured in your PATH environment variable, that's you are not able to executable your application manually (i.e. outside Qt Creator).
To fix this issue, you have 2 choices:
Compile your application selecting the release build;
Or add the full path to QtDeclaratived4.dll to the PATH environment variable.
QtDeclarative4.dll can be found in C:\[QT_INSTALL_DIR]\bin
You should definitely have this if you used the standard Windows installer that Qt distrubutes.

DLL is missing when launching Qt GUI app

My app launches from inside Qt Creator no problem, but when I go into the debug folder, I
find the .exe file and I try to launch it, it complains that there is a missing DLL called mingwm10.dll.
I don't know how to fix this problem I tried the release as my build target, same thing happened.
Unless you compiled Qt statically and link to it statically, you will need to copy the Qt DLLs with your app when you go to deploy it to another computer, just copy the mingwm10.dll with them (it's in at least two places in my Qt install: <install path>\Qt\2010.02.1\mingw\bin and <install path>\Qt\2010.02.1\qt\bin).
For just running on your own machine, I would suggest you add the <install path>\Qt\2010.02.1\qt\bin path to your "Path" environment variable. This should allow your apps to run properly outside the IDE without having to copy the dll around for every project until you go to deploy it elsewhere.
I think, there are two ways to fix this. You can copy the mingwm10.dll from the MinGW directory to the directory of your exe file or you can recompile Qt without the dependency to mingwm10.dll (which seems to be used for thread safe exception handling). I found some information about it here: http://lists.trolltech.com/qt-interest/2006-08/thread00942-0.html

Resources