Home >Backend Development >C++ >Why Doesn't My Qt Application Find the 'Windows' Platform Plugin on Windows Vista?

Why Doesn't My Qt Application Find the 'Windows' Platform Plugin on Windows Vista?

Barbara Streisand
Barbara StreisandOriginal
2024-11-30 07:31:11221browse

Why Doesn't My Qt Application Find the

Application Loading Error: "QT Platform Plugin "Windows" Not Found

The issue stems from an inability of the application to locate and load the QT platform plugin named "windows." Despite implementing suggested solutions from previous Stack Overflow inquiries, the problem persists.

Your application setup includes:

  • Windows 7 Professional x64
  • Visual Studio 2012
  • Qt 5.2.0 built with specific configurations
  • QtSingleApplication from qt-solutions
  • 32-bit application
  • qmake executed with specific parameters
  • .pri file using a compiler flag

The application builds and runs successfully on your development machine. However, when installed and executed on Windows Vista machines with various VC redistributions installed, the following error message appears:

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

To resolve this issue, a .platforms/ directory was created and populated with qwindows.dll (along with other DLLs). Despite these additions, the error message persists, now accompanied by the message:

Available platform plugins are: offscreen

Dependency Walker reveals an error:

GetProcAddress(0x76CA0000 [KERNEL32.DLL], "GetCurrentPackageId") called from "MSVCR110.DLL" at address 0x6AC6FDFA and returned NULL. Error: The specified procedure could not be found (127).

Solution:

To rectify the issue, qwindows.dll must be placed in a folder named platforms, with the path from the executable to the DLL being:

platforms/qwindows.dll

In addition, the following line must be added to the beginning of your main() function:

QCoreApplication::addLibraryPath("./");

These steps will allow the application to locate and load qwindows.dll, resolving the loading error.

The above is the detailed content of Why Doesn't My Qt Application Find the 'Windows' Platform Plugin on Windows Vista?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn