我正在尝试使用 bindgen 生成与 Qt6 的绑定。我已经按照这个答案尝试了这个: -
let bindings = bindgen::Builder::default()
.header("exclient.hpp")
.clang_arg("
-I/usr/include/qt6
-I/usr/include/qt6/QtCore
-I/usr/include/qt6/QtGui
-I/usr/include/qt6/QtQml
-I/usr/include/qt6/QtQuick
")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
但是当我尝试编译它时,我收到以下错误:-
--- stderr
/home/hilomen/Development/qtrusttest/target/debug/build/exclient3-d982a3579dd42390/out
warning:
-I/usr/include/qt6
-I/usr/include/qt6/QtCore
-I/usr/include/qt6/QtGui
-I/usr/include/qt6/QtQml
-I/usr/include/qt6/QtQuick
: 'linker' input unused [-Wunused-command-line-argument]
exclient.hpp:3:10: fatal error: 'QObject' file not found
warning:
-I/usr/include/qt6
-I/usr/include/qt6/QtCore
-I/usr/include/qt6/QtGui
-I/usr/include/qt6/QtQml
-I/usr/include/qt6/QtQuick
: 'linker' input unused [-Wunused-command-line-argument], err: false
exclient.hpp:3:10: fatal error: 'QObject' file not found, err: true
我可以确认/usr/include/qt6/QtCore/QObject
文件确实存在