Could not find or load the qt platforms plugin "windows"
-
Hi,
I know this is a repeating issue but none of the suggested solution I found managed to solve this problem.I get the following error on release configuration only: "This application failed to start because it could not find or load the Qt platform plugin "windows"".
It does work on debug configuration.
I did set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to "Qt\5.7\msvc2015_64\plugins\platforms" directory and I also tried to create a platforms directory in my exe directory and copy the qwindows.dll there.I use Visual Studio 2015 Community with CMake 3.5.2 and Qt5.7.
My CMake code:cmake_minimum_required(VERSION 3.1.0) project(qt5_test) # Find dependencies # =================================================== # Find the QtWidgets library find_package(Qt5Widgets) # Add executable # =================================================== #include_directories(${Qt5Widgets_INCLUDE_DIRS}) #add_executable(qt5_test WIN32 main.cpp main_windows.cpp) add_executable(qt5_test WIN32 main.cpp) # Use the Widgets module from Qt 5. target_link_libraries(qt5_test Qt5::Widgets)
My application code:
#include <qapplication.h> #include <qpushbutton.h> int main(int argc, char **argv) { QApplication a(argc, argv); QPushButton hello("Hello world!", 0); hello.resize(100, 30); hello.show(); return a.exec(); }
Please help.
Thanks in advance,
Yuval -
Did you try with the windows deployment tool? http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool
-
Did you try with the windows deployment tool? http://doc.qt.io/qt-5/windows-deployment.html#the-windows-deployment-tool
-
you can use QCoreApplication::addLibraryPath to decide the search locations for your plugins
-
Hi,
I know this is a repeating issue but none of the suggested solution I found managed to solve this problem.I get the following error on release configuration only: "This application failed to start because it could not find or load the Qt platform plugin "windows"".
It does work on debug configuration.
I did set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to "Qt\5.7\msvc2015_64\plugins\platforms" directory and I also tried to create a platforms directory in my exe directory and copy the qwindows.dll there.I use Visual Studio 2015 Community with CMake 3.5.2 and Qt5.7.
My CMake code:cmake_minimum_required(VERSION 3.1.0) project(qt5_test) # Find dependencies # =================================================== # Find the QtWidgets library find_package(Qt5Widgets) # Add executable # =================================================== #include_directories(${Qt5Widgets_INCLUDE_DIRS}) #add_executable(qt5_test WIN32 main.cpp main_windows.cpp) add_executable(qt5_test WIN32 main.cpp) # Use the Widgets module from Qt 5. target_link_libraries(qt5_test Qt5::Widgets)
My application code:
#include <qapplication.h> #include <qpushbutton.h> int main(int argc, char **argv) { QApplication a(argc, argv); QPushButton hello("Hello world!", 0); hello.resize(100, 30); hello.show(); return a.exec(); }
Please help.
Thanks in advance,
Yuval@ynirkin said:
It does work on debug configuration.
I did set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to "Qt\5.7\msvc2015_64\plugins\platforms" directory and I also tried to create a platforms directory in my exe directory and copy the qwindows.dll there.You shouldn't set it to the "platforms" folder, but to the (parent) "plugins" folder instead.