Well, I've spent a day looking for solution and have read everything but I am not able to deploy my Qt application, so I decided to ask.
I'm using Qt 5.2.1 via the Visual Studio Add-In in VS 2013 Ultimate, the qt version is msvcr2012. I have the x86 version of Qt 5.2 (now the 3rd from the bottom at Qt Downloads page).
I'm targeting Win7 32-bit.
My OS is Windows7 64-bit, I'm building the app for win32
, release
/o2 (max speed)
optimalization, /MD (dynamic C runtime)
, with libraries linked:
qtmain.lib
Qt5Core.lib
Qt5Gui.lib
Qt5Widgets.lib
Qt5PlatformSupport.lib //this one is added by me, the others are automatically set with the Qt-AddIn template.
I build it, and to the release folder I put the followings:
EDIT: because of the version of my compiler, I also distribute the vs2012 dll.s as you see.
.../release /plugins /platforms
I've set the addittional library path with (just for the 100% chance of finding them):
void registerPluginsDir(QDir& exeDir)
{
QString pluginsRelPath = "plugins";
QString platformsRelPath = "platforms";
QString pluginsPath = exeDir.absoluteFilePath(pluginsRelPath);
QString platformsPath = QDir(pluginsPath).absoluteFilePath(platformsRelPath);
QStringList pathes = QCoreApplication::libraryPaths();
pathes << pluginsPath;
pathes << platformsPath;
QCoreApplication::setLibraryPaths(pathes);
for (auto i : pathes)
qDebug() << i << "\n";
};
int main(int argc, char *argv[])
{
QString exePath = QString::fromUtf8(argv[0]);
QFileInfo exeInfo(exePath);
QDir exeDir(exeInfo.absolutePath());
registerPluginsDir(exeDir);
QApplication a(argc, argv);
KeyGenerator w;
w.show();
return a.exec();
};
The pathes are correct. With the debugger I saw they were loaded from my app folder, not from the Qt main folder.
With depends.exe I checked everything. I only get 2 warnings, no errors:
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
I've copied the .dll-s according to the .dll-s loaded when debugged the app in Visual Studio. The only difference between depends.exe and the debug, that in VS system dll-s were loaded from SysWOW64, not system32.
With all these on my (developer) pc it runs withouth any error, but on the test (Win7 32-bit running on Microsoft Virtual PC) pc I get the 'infamous' error:
Failed to load platform plugin “windows”. Available platforms are:
(and here there are the full pathes to the .dll-s,
eg: D:\cproj\keygen\win32\Release\plugins\platforms\qwindows.dll, so it must have found them.
I followed this too: http://qt-project.org/wiki/Deploy_an_Application_on_Windows.
Renamed the Qt-dir, the console only output the release folder as library inputs (not the Qt-folders like my first test). It loaded the dll-s from the app folders, launched well. However, on my virtual PC, or on my brother's pac (Win7 32bit) it gives me the error.ˇA picture about this:
How to run it on 32-bit machine? I tried it with every build, release-win32, debug-win32, none of them works. I can't test it on more machines, on XP it can't even load the C-runtime, but that's not a target platform.
For more info please comment.
EDIT: Dependency walker on target pc shows the same as on dev pc. It still finds the plugins, but can't load.