Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Cannot find the Qt platform plugin after migrating to Qt 6
Forum Updated to NodeBB v4.3 + New Features

Cannot find the Qt platform plugin after migrating to Qt 6

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 381 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HyperQuantum
    wrote on last edited by
    #1

    I am migrating my project from Qt 5 to Qt6.

    The project builds and runs successfully outside Qt Creator. I do have to run windeployqt before I can run the application. For this I have created a batch file that creates a build directory, runs CMake, builds the project, runs windeployqt, and copies some files manually (libmysql* and libssl*).

    Now I am trying to get the project to work in Qt Creator. It builds successfully, but when trying to run (debug) it, it fails because the platform plugin cannot be found:

    qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Debug Error!
    
    Program: ...\build\Desktop_Qt_6_8_1_MSVC2022_64bit-Debug\src\Qt6Cored.dll
    Module: 6.8.1
    File: C:\src\vcpkg\buildtrees\qtbase\src\here-src-6-9f6e91ffa0.clean\src\gui\kernel\qguiapplication.cpp
    Line: 1327
    
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    This problem did not occur when I was still using Qt 5.

    Could this be caused by Qt Creator mixing different instances of Qt? I am using vcpkg for building the dependencies of my project (taglib and Qt), but I also had to install Qt with the Maintenance Tool so a kit could be created in Qt Creator. Both Qt instances are version 6.8.1.

    To open the project in Qt Creator and get it to build I did the following:

    • Open the CMakeLists.txt file (fails to configure automatically)
    • Switch the kit to a Qt 6 kit (somehow a Qt 5 kit was still selected; configure fails again after switching)
    • Add CMake variable VCPKG_TARGET_TRIPLET with value x64-windows
    • Add CMake variable CMAKE_TOOLCHAIN_FILE and point it to C:\src\vcpkg\scripts\buildsystems\vcpkg.cmake
    • Reconfigure with initial parameters
    • Build

    So the projects builds successfully but refuses to run because of the missing platform plugin. I looked into adding a deploy step when running, but windeployqt or installing plugins isn't one of the options. And isn't Qt Creator supposed to take care of the plugins automatically anyway?

    The vcpkg plugin in Qt Creator is enabled, although I have no idea how to use it or what it is supposed to do. Back when I was still using Qt 5 I was using Qt Creator without that plugin.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved