這exist answer無法修復我的問題這個應用程序未能啓動,因爲它無法找到或加載了Qt平臺插件「XCB」
在Qt official example,我用下面的CMakeLists.txt
SET(CMAKE_PREFIX_PATH /media/roroco/disk750/Downloads/qtbase)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5Widgets)
find_library(xcb NAMES qxcb PATHS /media/roroco/disk750/Downloads/qtbase/plugins/platforms)
add_executable(systray main.cpp window.cpp systray.qrc)
target_link_libraries(systray Qt5::Widgets ${xcb})
我得到
This application failed to start because it could not find or load the Qt platform plugin "xcb".
如何將「xcb」插件添加到cmake?
更新
我敢肯定find_library(xcb
找到LIB 「/media/roroco/disk750/Downloads/qtbase/plugins/platforms/libqxcb.so」。
如果您在Ubuntu或Debian上,則xcb插件是'/ usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so'。它由'libqt5gui5'包安裝,所以它應該在那裏。 – Velkan