5

I have created an application by using Qt v5.3.1 with MinGW v4.8.2 on windows 7 32bit.
I have the following error when open my application:

I've inclusion all important files to run my application by using windeployqt.exe tool.

Also the platforms folder contains:

Also I've inclusion all important files to run my application manually without use windeployqt.exe tool, and the problem still exists.

I don't know how to solve this problem .


Edit

The the result of using Dependency Walker tool.

I'm still don't know how to get these dll files question mark.

Lion King
  • 32,851
  • 25
  • 81
  • 143
  • Qt's Windows support depends on numerous DLLs. Unfortunately, I don't remember where I found the list. Using [Dependency Walker](http://www.dependencywalker.com/) to see DLL dependencies or using [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) to see what load requests fail might help. – Josh Kelley Aug 27 '14 at 15:54
  • This guide is great for detailing deployment issues: http://www.tripleboot.org/?p=138. And I second using Dependency Walker, or even better Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) – Andrew Dolby Aug 27 '14 at 16:51
  • @JoshKelley: I'm have used the `Dependency Walker` tool, please see my question again. @AndrewDolby: please see my question again. – Lion King Aug 27 '14 at 17:17
  • 1
    Since qt5 some of the core functionality of Qt was moved to plugin Dlls that are dynamically loaded via dlopen/dlsym or LoadLibrary calls depending on the system, that's why you can't see a bunch of them in dependency walker. In this case you are missing the windows dll from the plugins/platform folder in your qt install location, there might be some others depending on which classes you need – Radu Chivu Aug 27 '14 at 17:19
  • Process Explorer or ListDlls (both Sysinterals utilities) will allow you to see the missing plugin dlls loaded in your app in your development environment. You can then check those against what you are deploying. It's strange that it can't find qwindows.dll though, since you have it in the correct location. You can try to change the plugin locations using qt.conf. This guide details the process: [Deploying a real Qt app](http://www.tripleboot.org/?p=536). Also, the IESHIMS.dll and WER.dll in your Dependency Walker view aren't needed for deployment. – Andrew Dolby Aug 27 '14 at 18:15
  • You can also try loading your qwindows.dll up in Dependency Walker to see if it's not missing any dependencies itself. It will need libEGL.dll if you're using an ANGLE build of Qt. – Andrew Dolby Aug 27 '14 at 18:27
  • Thank everyone for contributing to the understanding of the problem and how to solve it. – Lion King Aug 28 '14 at 17:57

2 Answers2

2

Firstly, thank everyone for contributing to the understanding of the problem and how to solve it.

Now, to solve this problem you must read this article Accurately, in order to understand first what is the problem, and then how to solve it. [Deploying a real Qt app – understanding more of Qt]

The conclusion In short :
the reason of the problem is the path of the plugins that you used in your project.
The default path to plugins that you used in your project is qt path folder, but when qt development environment not be installed on your machine, your application will not run, because the default path to plugins directed to qt path folder, and this is the problem.
We need to direct/change the plugins path to your application folder.

There are several ways to direct/change the path. I will mention the way in which I have already tried and succeeded in solving the problem

There is a static method named addLibraryPath(const QString & path), this method We will use it to direct/change the plugins path.

Example:

int main(int argc, char *argv[])
{
    QApplication::addLibraryPath("pluginsFolder");
    QApplication a(argc, argv);
    Widget w;
    w.show();


    return a.exec();
}

pluginsFolder is the folder that contain all plugins that you used in your project.

You can also change

QApplication::addLibraryPath("pluginsFolder");

To

QApplication::addLibraryPath(".");

This means that the plugins in the main application folder not in subdirectory named plugins.
And don't forget to use windeployqt.exe tool to deploy your project.

And finally, I hope that this the short explanation will be useful for those after me, who will face the same problem.

Lion King
  • 32,851
  • 25
  • 81
  • 143
  • are you using "pluginsFolder" or just "plugins" ? and inside pluginsfolder you have for example "platforms, sqldrivers,..." folders`? – user1767754 Jan 13 '15 at 18:17
  • @user1767754: `pluginsFolder` means the folder name which collects all the plugins(sqldrivers, platforms, etc) inside it , which in your application folder. – Lion King Jan 14 '15 at 02:36
  • QApplication::addLibraryPath("E:/plugins/"); didn't help even though i have the platforms, sqldrivers inside this folder – user1767754 Jan 14 '15 at 11:54
  • Add `QApplication::addLibraryPath("E:/plugins")` before QApplication object. for example: `QApplication::addLibraryPath("E:/plugins"); QApplication a(argc, argv);` – Lion King Jan 14 '15 at 22:57
1

Try adding libEGL.dll, libGLESv2.dll, and D3DCompiler_43.dll to the directory level with your QtApplication.exe. It's likely that qwindows.dll has them as a dependency and you're getting a silent failure as a result. You can tell if you'll need those if they're located in your Qt-Dir/bin. Failing that, opening qwindows.dll in Dependency Walker may help show a missing dependency.

Andrew Dolby
  • 799
  • 1
  • 13
  • 25