Hi I have a peculiar situation building my Qt program in Visual Studio 2019 using Qt 5.15.2. This is very similar, somewhat more deeply involved, than this issue. When building in Debug mode the program runs perfectly fine.
When running in release mode, originally I got the error: The application failed to start because no qt platform plugin could be initialized. Reinstalling the application may fix this problem.
After trying the things listed below I get the error: This application failed to start because no qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are direct2d (from C:\Qt\5.15.2\msvc2019_64\plugins\platforms), minimal (from C:\Qt\5.15.2\msvc2019_64\plugins\platforms), offscreen (from C:\Qt\5.15.2\msvc2019_64\plugins\platforms), windows (from C:\Qt\5.15.2\msvc2019_64\plugins\platforms), direct2d, minimal, offscreen, windows.
Things I have tried:
- Setting QT_PLUGIN_PATH environment variable to C:\Qt\5.15.2\msvc2019_64\plugins
- Setting QT_QPA_PLATFORM_PLUGIN_PATH environment variable to C:\Qt\5.15.2\msvc2019_64\plugins\platforms
- Setting QTDIR environment variable to C:\Qt\5.15.2\msvc2019_64\bin
- Addding C:\Qt\5.15.2\msvc2019_64\bin to the PATH environment variable
- Copying libEGL.dll and libEGLvs2.dll to the program's directory
- Running windeployqt targeting the release executable (this fixed things but I'm interested in fixing the problem in a more automated way, I shouldn't have to do this every time I build a program or change dependencies)
Anybody know how to resolve this issue? Thanks!