2
我試圖運行痛飲對供應商的頭,所以我並不需要重新實施在一個單獨的頭文件如何痛飲省略向前聲明
swig -go -cgo -intgosize 64 -module qt -o $WORK/qt/_obj/qt_wrap.cxx -outdir $WORK/qt/_obj/ \
-I$HOME/Qt5.9.1/5.9.1/gcc_64/include -I$HOME/Qt5.9.1/5.9.1/gcc_64/include/QtOpenGL \
-I$HOME/Qt5.9.1/5.9.1/gcc_64/include/QtWidgets -I$HOME/Qt5.9.1/5.9.1/gcc_64 \
/include/QtGui -I$HOME/Qt5.9.1/5.9.1/gcc_64/include/QtCore -c++ qt.swigcxx
我收到以下錯誤時go build
在檢查
qapplication.h:57
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
#include <QtGui/qcursor.h>
#ifdef QT_INCLUDE_COMPAT
# include <QtWidgets/qdesktopwidget.h>
#endif
#include <QtGui/qguiapplication.h>
QT_BEGIN_NAMESPACE
class QDesktopWidget;
前向聲明顯然失敗。
下面是qt.swigcxx:
// See swig.org for more inteface options,
// e.g. map std::string to Go string
%module qt
%{
#include <QPushButton>
#include <QApplication>
%}
%ignore "";
%include <qapplication.h>
%include <qpushbutton.h>
我怎樣才能改變使痛飲省略了向前聲明?
謝謝。我更喜歡第二個選項,現在卡住了typemap – user642318
你得到這個錯誤的原因是由於SWIG無法遞歸頭文件。如果你對接口非常嚴格(避免僅包含頭文件),並且按照需要的順序包含頭文件,SWIG可用於包裝相當大的項目。我使用近40,000行生成的代碼工作在一個項目上。 SWIG零件的構建方式比QT的東西快 –