sudo apt-get install qt5-default qt5-qmake g++ qtcreator
apt-get install qtdeclarative5-dev
windeployqt.exe xx.exe
windeployqt.exe --qmldir qmlPath xx.exe
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/lib\'"
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/../lib\'"
find_package(Qt5 COMPONENTS Core Gui Xml Multimedia Network MultimediaWidgets Widgets REQUIRED)
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5MultimediaWidgets_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
target_link_libraries(MyApp
PRIVATE Qt5::Core Qt5::Gui Qt5::Xml Qt5::Multimedia Qt5::Network Qt5::MultimediaWidgets Qt5::Widgets)
export QT_DEBUG_PLUGINS=1
编译qt是设置 -bundled-xcb-xinput
-bundled-xcb-xinput
Correct as described here: https://doc.qt.io/qt-5/linux-requirements.html
Note: From Qt 5.15 onwards, Qt does require libxcb 1.11. Also, the -qt-xcb configure option got removed that was bundling some of the libs below. Anyhow, you can now configure with -bundled-xcb-xinput to avoid a dependency to system xcb-xinput.
qml使用C++对象,会被前端释放导致程序崩溃,5.14 5.15版本没问题