This application failed to start because no qt platform plugin could be initialized windows

This application failed to start because no qt platform plugin could be initialized windows

I read several posts about this topic here and in other websites, but most were about the older versions of QT. I tried to apply them but whit no results. I also tried to reinstall QT and to update whatever I can update.

The full message I receive is the following:

(base) ProOne:Dashboard adrianosavi$ export QT_DEBUG_PLUGINS=1(base) ProOne:Dashboard adrianosavi$ /Users/adrianosavi/opt/anaconda3/bin/python «/Users/adrianosavi/OneDrive/Offline Files/Savio Shandong/IT/Dashboard/test.py»
QFactoryLoader::QFactoryLoader() checking directory path «/Users/adrianosavi/opt/anaconda3/plugins/platforms» .
QFactoryLoader::QFactoryLoader() looking at «/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib»
Found metadata in lib /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib, metadata=
<
«IID»: «org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3»,
«MetaData»: <
«Keys»: [
«cocoa»
]
>,
«className»: «QCocoaIntegrationPlugin»,
«debug»: false,
«version»: 329991
>

Got keys from plugin meta data («cocoa»)
QFactoryLoader::QFactoryLoader() looking at «/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqminimal.dylib»
Found metadata in lib /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqminimal.dylib, metadata=
<
«IID»: «org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3»,
«MetaData»: <
«Keys»: [
«minimal»
]
>,
«className»: «QMinimalIntegrationPlugin»,
«debug»: false,
«version»: 329991
>

Got keys from plugin meta data («minimal»)
QFactoryLoader::QFactoryLoader() looking at «/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqoffscreen.dylib»
Found metadata in lib /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqoffscreen.dylib, metadata=
<
«IID»: «org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3»,
«MetaData»: <
«Keys»: [
«offscreen»
]
>,
«className»: «QOffscreenIntegrationPlugin»,
«debug»: false,
«version»: 329991
>

Got keys from plugin meta data («offscreen»)
QFactoryLoader::QFactoryLoader() checking directory path «/Users/adrianosavi/opt/anaconda3/bin/platforms» .
Cannot load library /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib: (dlopen(/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib
Referenced from: /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib
Reason: image not found)
QLibraryPrivate::loadPlugin failed on «/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib» : «Cannot load library /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib: (dlopen(/Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib\n Referenced from: /Users/adrianosavi/opt/anaconda3/plugins/platforms/libqcocoa.dylib\n Reason: image not found)»
qt.qpa.plugin: Could not load the Qt platform plugin «cocoa» in «» even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa, minimal, offscreen.

I hope I can receive support for this issue.

Приложение не удалось запустить, так как не удалось найти или загрузить плагин QT platform » windows»

Я просмотрел все вопросы, которые, по-видимому, связаны с переполнением стека, и ни одно из решений, кажется, не помогает мне.

Я создаю приложение Qt с этой настройкой:

  • Windows 7 Professional x64
  • Visual Studio 2012
  • Qt 5.2.0 построен с помощью configure -developer-build -debug-and-release -opensource -nomake examples -nomake tests -platform win32-msvc2012 -no-opengl
  • проект использует QtSingleApplication (qt-solutions)
  • приложение является 32-битным приложением
  • qmake запускается со следующими параметрами: — makefile-spec win32-msvc2012
  • .pri использует QMAKE_CXX += /D_USING_V110_SDK71_

Я могу построить и запустить свою программу нормально на моей машине разработки (отмечено выше); я также могу установить и запустить пакет из каталога Program Files на машине разработки.

Когда я устанавливаю и запускаю на машине Windows Vista (несколько машин)

  • VC++ redist 2012 11.0.61030.0 установлен
  • VC++ redist 2010 10.0.40219 установлен
  • плюс 2005, 2008 версии redist

(также терпит неудачу на a чистая установка Windows 7)

Application failed to start because it could not find or load the QT platform plugin «windows»

Поэтому я последовал инструкциям и добавил a .платформы / каталог, и добавил qwindows.dll (также добавлен qminimal.dll и qoffscreen.dll); я также добавил libEGL.dll, libGLESv2.dll (хотя я не думаю, что они мне понадобятся)

Однажды я добавил qoffscreen.dll теперь я получаю дополнительное сообщение: Available platform plugins are: offscreen

Если я пробегаю через Dependency Walker, я получаю эту ошибку в списке:

А затем еще ниже получаем the:

Есть идеи, как исправить эту проблему dll?

11 ответов:

Ошибка вызвана тем, что программа не может найти qwindows.dll

qwindows.dll должен находиться в папке с именем platforms , так что путь от вашего исполняемого файла к dll будет platforms/qwindows.dll

Хотя в моем случае этого было недостаточно. Мне также пришлось добавить следующую строку в начале моего main () Тогда все сработало.

Я получил эту проблему и как я ее решил:

Используемая зависимость walker (http://www.dependencywalker.com/), чтобы увидеть точный путь необходимых библиотек DLL. Попробуйте, потому что и QtCreator, и Qt framework имеют одинаковые библиотеки DLL, и вы должны точно определить, какие из них используются. Я скопировал все необходимые библиотеки DLL в ту же папку, что и приложение.

Я скопировал папку platforms из Qt framework / plugins и скопировал ее в ту же папку, что и приложение. Теперь приложение вступило в силу также плагин / платформа / папка со всеми своими DLL

И самым важным шагом в моем случае является создание файла с именем qt.conf в той же папке, что и приложение . Этот файл должен содержать путь к плагинам. Мой qt.файл conf содержит:

[пути]
Библиотеки=../lib / qtcreator
Plugins=Плагины
Импорт=импорт
Qml2Imports=qml

Приложение может работать на хост-системе, так как путь Qt bin находится в переменной system PATH .

Существует стандартный инструмент Qt для развертывания приложений Qt на Windows windeployqt чтобы иметь возможность запускать приложение на целевых машинах, на которых не установлен Qt.

Этот инструмент заботится о зависимостях Qt DLL, делает копию platforms\qwindows.dll , а также делает копию библиотек, которые вы не можете обнаружить с помощью Dependency Walker , так как Плагины изображений и некоторые другие библиотеки DLL загружаются во время выполнения.

Вам даже не нужно иметь папку Qt bin в вашей среде PATH . Самое простое развертывание:

  • скопировать построенный exe двоичный файл в новую папку
  • откройте консоль cmd в этой папке
  • вызовите windeployqt используя полный путь (если его нет в системе PATH ) и предоставьте свой исполняемый файл, например:

В результате у вас есть в этой папке все необходимые библиотеки DLL Qt, чтобы запустить приложение.

Инструмент windeployqt имеет различные опции. Он также может позаботиться о развертывании связанных файлов qml .

Конечно, вы можете иметь также проблемы с MSVC redistributables, но они должны быть развернуты отдельно и установлены один раз в системе.

Только некоторые сторонние библиотеки должны быть скопированы вручную, если они используются, например OpenSSL.

У меня была та же проблема «приложение не удалось запустить, потому что он не мог найти или загрузить Qt platform plugin» windows» Я исправил это, скопировав файлы ниже в приложение.папка exe (my app executable),

Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll и каталог «платформ» с qminimal.проблемы, qoffscreen.dll, qwindows.файл DLL.

Я надеюсь, что это кому-то поможет

Примечание эта проблема можеттакже быть вызвана, если путь поиска для qwindows.dll , который закодирован в вашем приложении, включает путь, где вы установили Qt. Рассмотрим следующий сценарий:

  1. я устанавливаю Qt на c:\Qt\.
  2. я разрабатываю приложение и правильно развертываю его в другом месте.
  3. он работает на любом компьютере правильно, потому что он включает qwindows.dll в подкаталог.
  4. я обновляю свой локальный Qt до новой версии.
  5. я пытаюсь запустить свое приложение снова.

Результатом является эта ошибка, потому что qwindows.dll в c:\Qt\. находится перед в его локальном каталоге и он несовместим с ним. Очень раздражать.

Решение состоит в том, чтобы поместить файл qt.conf в тот же каталог, что и ваш exe-файл. Я не знаю, как этого избежать. Если вы использовали инструмент windeployqt.exe для развертывания вашего приложения, поэтому у вас есть подкаталог с именем platforms , то этого достаточно:

Для людей, у которых эта проблема в будущем — у меня есть грязный маленький хак, работавший на меня. Попробуйте на свой страх и риск.

Выполните все шаги в начальном развертывании (быстрый и грязный) [http://wiki.qt.io/Deploy_an_Application_on_Windows]

  1. Закройте Qt Creator.
  2. скопируйте следующее в C:\Deployment\ версия выпуска MyApp.ехе все свои .dll файлы из C:\Qt\5.2.1\mingw48_32\bin\ все папки из C:\Qt\5.2.1\mingw48_32\plugins\
  3. (Если вы использовали QML) все папки из C:\Qt\5.2.1\mingw48_32\qml\ переименовать C:\Qt\ to C:\QtHidden\ (это превращает ваш компьютер в чистую среду, точно так же, как тот, на котором не установлен Qt).
  4. Запуск C:\Deployment\MyApp.exe.

Теперь для взлома —

  1. дублируйте папку для безопасности
  2. Если ваш файл был в/cat / Deployment, перейдите в /cat
  3. Теперь удалите папку развертывания в то время как .exe все еще работает. Он скажет вам, что не может этого сделать. удалить определенные файлы, так сказать пропустить(или пропустить все)
  4. то, что у вас осталось, — это список всех .dll файлы, которые ваши .exe на самом деле использовал и не мог удалить: список всех файлов и только те файлы, которые нужно сохранить.

Вы можете закрыть .теперь exe-файл. Чтобы проверить, нормально ли он развертывается, зайдите в папку, где вы его установили, и скажите: C:/Qt и переименовать его в C:/NotQt (в основном сделать Qt невидимым для системы). Если он работает сейчас, то будет развернут на других системах чаще всего-нет.

Ну, я решил свою проблему, хотя и не уверен, в чем разница:

Я скопировал каждую dll из моего каталога qt в оба ./ и ./ платформы каталога моих приложений.

Приложение прошло мимо ошибки, но затем разбилось.

Версия.dll вызывала сбой (отмечено в dependency walker), поэтому я удалил его из обоих мест.

Приложение запустилось, поэтому я систематически удалял все ненужные dll.

Это вернуло меня в то же состояние, в котором я был. первоначально.

Затем я удалил свое приложение и повторно установил (только с помощью ./ платформы / qwindows.dll файл остается), приложение работает правильно.

Таким образом, все, что я могу предположить, это то, что у меня была неправильная версия qwindows.DLL в каталог платформы.

У меня та же проблема.: 1. он может работать в VS2010; 2. он может работать в папке с файлами как: апп.exe \платформы\qwindows.файл DLL .

    Но он не смог загрузить qwindows на чистую машину с той же ОС, что и развивающаяся.

Решается простым перемещением папки платформы в плагины: апп.exe Плагины\платформы\qwindows.dll

Плюс: qwindows.DLL может быть переименован в любое вам нравится, как она запрашивается с помощью плагина interafce: qt_plugin_query_metadata ()

В нем отсутствуют qwindows.dll, которая обычно должна быть в платформах, если вы не добавляете:

Если вы этого не сделаете, кстати, и поставьте свои qwindows.dll где-то еще, Qt будет искать ваш путь для DLL, что может занять много времени (10s — несколько минут)!

Для меня, я должен был установить QT_QPA_PLATFORM_PLUGIN_PATH в каталог платформ, и тогда это сработало.

Как бы то ни было, это решение также было упомянуто на GitHub .

Попробовал все вышеперечисленное-оказалось, что для меня это было просто потому, что у меня не было основной библиотеки DLL Qt в папке apps

Qt 5.1.1: Application failed to start because platform plugin “windows” is missing

Edit: Some people started to mark my question as a duplicate. Do not forget that many similar questions existed when I asked this one (see e.g. the list below). However, none of these answers solved my problem. After a long search I found a comment which had been ignored by all users pointing to the missing lib. Now, many months later, the comment has been changed to an answer. However, when I answered this question by msyself I intended to help other people by directly providing the solution. This should not be forgotten and so far my answer helped a lot of people. Therefore my question is definitely not a duplicate. By the way: The accepted answer within the provided link on top does not solve the problem!

Yes, i used the search:

However, in my case the problem still persists. I am using Qt 5.1.1 with Visual Studio 2012 and developed my Application on Windows 7 with Qt Creator 2.8.1. Application is compiled in «Release»-mode and can be executed if directly started with Qt Creator.

However, when starting from the «release»-Folder, i get the following message:

This application failed to start because it could not find or load the Qt platform plugin «windows». Available platform plugins are: minimal, offscreen, windows.

Folder structure looks like this:

Platforms is the folder directly copied from Qt\Qt5.1.1\5.1.1\msvc2012\plugins\platforms including e.g. qwindows.dll. Does not matter if I rename it to «platform» as some other users did. Qt is still not finding the «platform plugin windows», where is my mistake?

19 Answers 19

Okay, as posted here https://stackoverflow.com/a/17271172/1458552 without much attention by other users:

The libEGL.dll was missing! Even though this has not been reported when trying to start the application (all other *.dlls such as Qt5Gui.dll had been reported).

I created a platforms directory next to my exe location and put qwindows.dll inside, but I still received the «Failed to load platform plugin «windows». Available platforms are: windows» error.

I had copied qwindows.dll from C:\Qt\Qt5.1.1\Tools\QtCreator\bin\plugins\platforms, which is not the right location. I looked at the debug log from running in Qt Creator and found that my app was looking in C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\platforms when it ran in the debugger.

When I copied from C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\platforms, everything worked fine.

The release is likely missing a library/plugin or the library is in the wrong directory and or from the wrong directory.

Qt intended answer: Use windeployqt. see last paragraph for explanation

Create a folder named «platforms» in the same directory as your application.exe file. Copy and paste the qwindows.dll, found in the /bin of whichever compiler you used to release your application, into the «platforms» folder. Like magic it works. If the .dll is not there check plugins/platforms/ ( with plugins/ being in the same directory as bin/ )

Setting the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to %QTDIR%\plugins\platforms\ worked for me.

It was also mentioned here and here.

I ran into this and none of the answers I could find fixed it for me.

My colleauge has Qt (5.6.0) installed on his machine at: C:\Qt\Qt5.6.0\5.6\msvc2015\plugins
I have Qt (5.6.2) installed in the same location.

I learned from this post: http://www.tripleboot.org/?p=536, that the Qt5Core.dll has a location to the plugins written to it when Qt is first installed. Since my colleague’s and my Qt directories were the same, but different version of Qt were installed, a different qwindows.dll file is needed. When I ran an exe deployed by him, it would use my C:\Qt\Qt5.6.0\5.6\msvc2015\plugins\platforms\qwindows.dll file instead of the one located next to the executable in the .\platforms subfolder.

To get around this, I added the following line of code to the application which seems to force it to look next to the exe for the ‘platforms’ subfolder before it looks at the path in the Qt5Core.dll.

I added the above line to the main method before the QApplication call like this:

create dir platforms and copy qwindows.dll to it, platforms and app.exe are in the same dir

cd app_dir mkdir platforms xcopy qwindows.dll platforms\qwindows.dll

Folder structure + app.exe + platforms\qwindows.dll

I found another solution. Create qt.conf in the app folder as such:

And then copy the plugins folder into the app folder and it works for me.

Most of these answers contain good (correct) info, but in my case, there was still something missing.

My app is built as a library (dll) and called by a non-Qt application. I used windeployqt.exe to set up the Qt dlls, platforms, plugins, etc. in the install directory, but it still couldn’t find the platform. After some experimentation, I realized the application’s working directory was set to a different folder. So, I grabbed the directory in which the dll «lived» using GetModuleHandleExA and added that directory to the Qt library path at runtime using

This worked for me.

For me the solution was to correct the PATH variable. It had Anaconda3\Library\bin as one of the first paths. This directory contains some Qt libraries, but not all. Apparently, that is a problem. Moving C:\Programs\Qt\5.12.3\msvc2017_64\bin to the front of PATH solved the problem for me.

I had this problem while using QT 5.6, Anaconda 4.3.23, python 3.5.2 and pyinstaller 3.3. I had created a python program with an interface developed using QTcreator, but had to deploy it to other computers, therefore I needed to make an executable, using pyinstaller.

I’ve found that the problem was solved on my computer if I set the following environment variables:

But this solution only worked on my PC that had conda and qt installed in those folders.

To solve this and make the executable work on any computer, I’ve had to edit the «.spec» (file first generated by pyinstaller) to include the following line:

datas=[( ‘C:\Miniconda3\pkgs\qt-5.6.2-vc14_3\Library\plugins\platforms*.dll’, ‘platforms’ ),]

This solution is based on the answers of Jim G. and CrippledTable

I had the same problem and solved it by applying several things. The first, if it is a program that you did with Qt.

In the folder (in my case) of «C: \ Qt \ Qt5.10.0 \ 5.10.0 \ msvc2017_64 \ plugins» you find other folders, one of them is «platforms». That «platforms» folder is going to be copied next to your .exe executable. Now, if you get the error 0xc000007d is that you did not copy the version that was, since it can be 32bits or 64.

If you continue with the errors is that you lack more libraries. With the «Dependency Walker» program you can detect some of the missing folders. Surely it will indicate to you that you need an NVIDIA .dll, and it tells you the location.

Another way, instead of using «Dependency Walker» is to copy all the .dll from your «C: \ Windows \ System32» folder next to your executable file. Execute your .exe and if everything loads well, so you do not have space occupied in dll libraries that you do not need or use, use the .exe program with all your options and without closing the .exe you do is erase all the .dll that you just copied next to the .exe, so if those .dll are being used by your program, the system will not let you erase, only removing those that are not necessary.

I hope this solution serves you.

Remember that if your operating system is 64 bits, the libraries will be in the System32 folder, and if your operating system is 32 bits, they will also be in the System32 folder. This happens so that there are no compatibility problems with programs that are 32 bits in a 64-bit computer. The SysWOW64 folder contains the 32-bit files as a backup.

For anyone coming from QT version 5.14.0, it took me 2 days to find this piece statment of bug:

windeployqt does not work for MinGW QTBUG-80763 Will be fixed in 5.14.1

So be aware. Using windeployqt withMinGW will give the same error stated here.

For a MinGW platform and if you are compiling a Debug target by a hand made CMakeLists.txt written ad hoc you need to add the qwindows.dll to the platform dir as well. The windeployqt executable does its work well but it seems that for some strange reason the CMake build needs the release variant as well. In summary it will be better to have both the qwindows.dll and qwindowsd.dll in your platform directory. I did not notice the same strange result when importing the CMake project in QtCreator and then running the build procedure. Compiling on the command line the CMake project seems to trigger the qwindows.dll dependency either if the correct one for the Debug target is set in place (qwindowsd.dll)

Use this batch file: RunWithQt.bat

  • to use it, drag your gui.exe file and drop it on the RunWithQt.bat in explorer,
  • or call RunWithQt gui.exe from the command line

If you have Anaconda installed I recomend you to uninstall it and try installing python package from source, i fixed this problem in this way

The application qtbase/bin/windeployqt.exe deploys automatically your application. If you start a prompt with envirenmentvariables set correctly, it deploys to the current directory. You find an example of script:

Lets say, you wanted to have some CGAL-Demos portable. So you’d have a folder «CGAL», and in it, 1 subfolder called «lib»: all (common) support-dlls for any programs in the CGAL-folder go here. In our example, this would be the Dll-Download: simply unzip into the «lib» directory. The further you scroll down on the demos-page, the more impressive the content. In my case, the polyhedron-demo seemed about right. If this runs on my 10+ yo notebook, I’m impressed. So I created a folder «demo» in the «CGAL»-directory, alongside «lib». Now create a .cmd-file in that folder. I named mine «Polyhedron.cmd». So we have a directory structure like this:

In this little example, «Polyhedron.cmd» contains the following text:

All scripts can be the same apart from the last line, obviously. The only caveat is: the «DOS-Window» stays open for as long as you use the actual program. Close the shell-window, and you kill the *.exe as well. Whereever you copy the «CGAL»-folder, as the weird «%

Читайте также:  Сделать proxy для всей windows
Оцените статью