Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
6.5.1
-
None
Description
I use vcpkg to instll qt. Which will install qt
qtbase:x64-windows 6.5.1 Qt Application Framework Base Module. Includes C... qtbase:x86-windows 6.5.1#3 Qt Application Framework Base Module. Includes C..
Then I use cmake to build a simple qt gui application. Cmake script:
cmake_minimum_required(VERSION 3.16) add_subdirectory(cmake_tools) ensure_vcpkg() project(qt-cmake) find_package(Qt6 CONFIG REQUIRED COMPONENTS Core Widgets) add_executable(qt-cmake src/main.cc src/mainwindow.cc) target_link_libraries(qt-cmake PRIVATE Qt6::Core Qt6::Widgets)
The
add_subdirectory(cmake_tools)
ensure_vcpkg()
Just do init vcpkg staff.
But when I run this project, the error show:
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
After some debug, I find qt5 is ok, and in FindQt5.cmake, will load Qt5CoreConfig.cmake, there some script like this:
add_library(Qt5::QWindowsIntegrationPlugin MODULE IMPORTED) if(EXISTS "${_qt5Gui_install_prefix}/plugins/platforms/qwindows.dll") _populate_Gui_plugin_properties(QWindowsIntegrationPlugin RELEASE "platforms/qwindows.dll" FALSE) endif() if(EXISTS "${_qt5Gui_install_prefix}/debug/plugins/platforms/qwindowsd.dll") _populate_Gui_plugin_properties(QWindowsIntegrationPlugin DEBUG "platforms/qwindowsd.dll" FALSE) endif() list(APPEND Qt5Gui_PLUGINS Qt5::QWindowsIntegrationPlugin) set_property(TARGET Qt5::Gui APPEND PROPERTY QT_ALL_PLUGINS_platforms Qt5::QWindowsIntegrationPlugin) set_property(TARGET Qt5::QWindowsIntegrationPlugin PROPERTY QT_PLUGIN_TYPE "platforms") set_property(TARGET Qt5::QWindowsIntegrationPlugin PROPERTY QT_PLUGIN_EXTENDS "-") set_property(TARGET Qt5::QWindowsIntegrationPlugin PROPERTY QT_PLUGIN_CLASS_NAME "QWindowsIntegrationPlugin")
But I didn't find things like this in Qt6.