Failed to find platform after deploy Qt5.2 compiled desktop app
-
I downloaded and installed qt-windows-opensource-5.2.0-msvc2012-x86_64-offline.exe on Win7, with VS2012.
After successfully compiled a desktop app, I want to deploy it to a different machine. To test it, I removed "QtDir\bin" from my PATH environment variable. The app starts to complain missing various dlls.
I copied all necessary dlls to the same directory as the app executable, until I saw a strange error message:
- This application failed to start because it could not find or load the Qt platform plugin "windows".
After searching the forum, I have created directory containing platform dlls with path
- platforms\qwindows.dll
However, the error still persist unless I add back "QtDir\bin" to PATH.
Could someone help find out what could the possible problems?
Thanks.
-
Please read the official "deployment guide":http://qt-project.org/doc/qt-5/windows-deployment.html.
-
Thanks for the link.
I have read the article and tried all possible options:
- use addLibraryPath
- use qt.conf
But still no luck.
The problem is I don't know how to debug this, or at least make the app print out the actual library path. The app just print an error message in the dialog and exit.
-
-Use the Dependency Walker.-
-If you want to print PATH from within your application, you can do so with getenv/ qgetenv. That will obviously not work if there are any DLLs missing, as the error message is displayed by the Operating System even before the application is started.-
EDIT sorry for double-posting, the forum was having some trouble publishing my post.
-
Use the Dependency Walker, and really make sure you follow the whole guide: I know it's a long and boring read, but it really works ;) I know for some people, the problem is caused by missing OpenGL libraries, you can check those.
If you want to print PATH from within your application, you can do so with getenv or qgetenv. That will obviously not work if there are any DLLs missing, as the error message is displayed by the Operating System even before the application is started.