I am trying to modify following simple code from here to use Qt in Go.
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
My Go (Golang) code is:
package main
import (
"github.com/therecipe/qt"
"github.com/therecipe/qt/widgets"
)
func main() {
a := qt.NewQApplication(len(os.Args), os.Args) //ch: widgets.NewQ..
hello := widgets.QPushButton( "Hello world!", 0 )
a.setMainWidget( &hello )
hello.Show()
a.Exec()
}
However, I get following error:
# github.com/therecipe/qt/core
core.cpp:9:30: fatal error: QAbstractAnimation: No such file or directory
#include <QAbstractAnimation>
^
compilation terminated.
I have installed Qt bindings in Go using command:
go get "github.com/therecipe/qt"
I am working on Debian9 Linux and have following Qt4 packages installed:
libntrack-qt4-1 016-1.3 016-1.3 016-1.3 install
libqt4-dev 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
libqt4-dev-bin 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
libqt4-opengl-dev 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
python-qt4 4.11.4+dfsg-2+b1 4.11.4+dfsg-2+b1 4.11.4+dfsg-2+b1 install
qt4-default 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
qt4-linguist-tools 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
qt4-qmake 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 4:4.8.7+dfsg-11 install
ruby-qt4 4:4.14.3-1+b3 4:4.14.3-1+b3 4:4.14.3-1+b3 install
Where is the problem and how can it be solved? Thanks for your help.
Edit: For installing, I followed commands at https://github.com/therecipe/qt/wiki/Installation-on-Linux [Your system package managers version (without Android support)]. However, the command qtsetup gives following output with error:
$ sudo /home/abcde/go/bin/qtsetup
ERRO[0000] failed to run command _func=RunCmd cmd="go env GOMOD" dir= env= error="exec: \"go\": executable file not found in $PATH" name=GOMOD