QtCored4.dll was not found
-
I can compile and run a project in Qt Creator, but when I run the executable in Windows, i.e., try to execute the program by double clicking the exe file, an error message box is popped up, saying "This application has failed to start because QtCored4.dll was not found. Re-installing the application my fix this problem." I searched QtCored4.dll on my computer, and it could not be found. Could any one tell me what's wrong? Thanks a lot!
-
If it happens on the same machine that you develop on, then you need to look at your library paths. If not, then I suggest looking into Dependency Walker to help you determine all the dll dependencies of your application so that you can deploy them together. Have a look at this page "Qt Deployment":http://doc-snapshot.qt-project.org/4.8/deployment.html for a better explanation of what is required.
-
Check where you have installed Qt and the version that you are using . I found the file in
C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin . You need to copy the .dll files to the same folder where you have the executable file. For other missing dlls you can look up with Dependency Walker as specified in the above post. -
Thanks all who replied to my question. According to Sam, I guess the problem is due to my Qt installation. I installed Qt 4.8.1 MinGW on my PC running Windows XP, and C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin folder does not exist on my PC though folder C:\QtSDK\Desktop\Qt does exist. But I cannot understand why the program can run in Qt Creator? It looks that it does not use QtCored4.dll when the program runs in Qt Creator. Any insight into this?
-
I got the same error message:
The program can't start because QtCored4.dll is missing from your computer. Try reinstalling the program to fix this problem.
OK
How to resolve it:
Search for that file in your hard disk (it should be located in your bin directory of Qt folder) then add the path to the bin directory (e.g C:\Qt\4.8.5\bin) to your PATH variable and restart Visual Studio.
-
It's because in Qt creator it has access to the Qt path stuff. It's development environment vs distribution problem.
Basically you will need to copy all the dlls that your application uses to the app's directory.
This includes all the Qt dlls, and the mingw dlls that it needs. It will also need the platform dlls in a specific directory and any plugins you may rely on in your application.
Here is a "doc":http://qt-project.org/doc/qt-5/windows-deployment.html on deploying Qt5 applications. This is basically what you need to do to run the app outside a development environment.
Using a dependency walker like "this":http://www.dependencywalker.com/ will let you locate which DLLs your app needs.
You can bypass the deployment stuff if you add the paths to your DLLs to your system path. I think this is a very bad idea though as when you go to deploy you have a good chance of messing up your package and it won't work on non-developers computers. Also if you do this you could potentially build against one version of Qt and use the DLLs of a different one.
Here is an example of a mingw deployment directory:
@
app.exe
platforms/qminimal.dll
platforms/qwindows.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5Widgets.dll
libstdc++-6.dll
libgcc_s_sjlj-1.dll
@Note that yours will not be the same dlls, especially the mingw ones. They will be specific to your build environment. You can find the names with dependency walker or just by running the program, fixing what it complains about, then rerunning until it works.
You can find the mingw dlls in the mingw compiler's directory, and qt dlls in the qt install lib directory.
-
[quote author="ambershark" date="1405730250"]Note that yours will not be the same dlls, especially the mingw ones. They will be specific to your build environment.[/quote]...and Qt version :) (all the previous posters asked about Qt 4, which doesn't need the platforms DLLs)
-
Oops, good point. I'm so used to deploying Qt5 these days I don't even remember Qt4 or 3 anymore, lol.