[Interest] [Development] When debugging an application (using visual studio), Failed to load platform plugin "windows". Available platforms are:
Kai.Koehne at digia.com
Mon May 13 08:56:04 CEST 2013
First of all please ask questions regarding the use of Qt on interest at qt-project.org - Use development at qt-project.org only if you want to e.g. propose a fix. I took the liberty to move the thread there. Some comments below.
> -----Original Message-----
> From: development-bounces+kai.koehne=digia.com at qt-project.org
> [mailto:development-bounces+kai.koehne=digia.com at qt-project.org] On
> Behalf Of ???
> Sent: Saturday, May 11, 2013 9:12 AM
> To: development at qt-project.org
> Subject: [Development] When debugging an application (using visual studio),
> Failed to load platform plugin "windows". Available platforms are:
> In normal condition, When I press F5 (Start Debugging) in Visual Studio, it will
> start an new debug instance, loading all dependent Qt dlls and plugins from
> $(QTDIR). The ‘platforms’ folder is located at $(QTDIR)\plugins. I don’t copy it
> to my application’s folder, but it can find the plugins.
Qt tries to search for plugins in the QT directory, except if you specify a qt.conf file along your .exe, or have used QApplication::addLibraryPath() or QApplication::setLibraryPaths(). Double-check that you haven't added e.g. a qt.conf by accident/during tests.
You should check whether
- the loading of plugins fails only when debugging (e.g. does 'Run' work normally?)
- if the latter, that the Qt installation indeed contains debug versions (Xd.dll) of the plugins.
> But sometimes things go bad. When I press F5 (Start Debugging), it can find
> Qt dlls like Qt5Guid.dll,Qt5Quickd.dll, and so on from $(QTDIR)\bin, but can’t
> find plugins from $(QTDIR)\plugins
> When it can’t find the plugin, this condition will last long time.
In general you can try to run your application in 'depends.exe' (Profile mode), though I don't know whether you can embed this in your VS debugging setup. Also, you might want to set the QT_DEBUG_PLUGINS environment variable to a value, and then check the output when running your application.
> And I copied the QtDir to another machine then it works well there.
This is only supported if you have exactly the same directory structure, or use qt.conf.
> What may the problem be? In normal condition, what mechanism do Qt use
> to find these plugins when debugging a program?
> I guess QtVSAddin is handling these. So is it a Bug of QtVSAddin ?
I doubt that the QtVSAddin does anything in this context. There should be nothing special about debugging, except maybe that the debug version of your application / the Qt libs and plugins are used.
More information about the Interest