how to swig omit forward declaration

Viewed 434

I am trying to run swig on vendor header so I do not need to redefine the implementation in a separate header file

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

I am getting the error below during go build

$HOME/Qt5.9.1/5.9.1/gcc_64/include/QtWidgets/qapplication.h:57: Error: Syntax error in input(1).

Upon inspecting

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;

Obviously fail on the forward declaration.

Below is 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>

How can I change so that swig omits the forward declaration?

1 Answers
Related