go语言的一个gui 开源 项目 https://github.com/andlabs/ui
1 安装 mingw-w64 链接地址:
http://mingw-w64.sourceforge.net/download.php
2 liteide 配置:
# native compiler windows 386
GOROOT=c:\go
GOBIN=%GOROOT%\bin
GOARCH=386
GOOS=windows
CGO_ENABLED=1
PATH=C:\Program Files\mingw-w64\i686-4.9.2-win32-dwarf-rt_v3-rev1\mingw32\bin;%GOROOT%\bin;%PATH%
#GOPATH=c:\go
LITEIDE_GDB=gdb
LITEIDE_MAKE=make
LITEIDE_TERM=%COMSPEC%
LITEIDE_TERMARGS=
LITEIDE_EXEC=%COMSPEC%
LITEIDE_EXECOPT=/C
3 考入例子源码:
package main import ( "github.com/andlabs/ui" ) var window ui.Window func main() { go ui.Do(func() { name := ui.NewTextField() button := ui.NewButton("Greet") greeting := ui.NewLabel("") stack := ui.NewVerticalStack( ui.NewLabel("Enter your name:"), name, button, greeting) window = ui.NewWindow("Hello", 200, 100, stack) button.OnClicked(func() { greeting.SetText("Hello, " + name.Text() + "!") }) window.OnClosing(func() bool { ui.Stop() return true }) window.Show() }) err := ui.Go() if err != nil { panic(err) } }
4 效果截图:
有疑问加站长微信联系(非本文作者)

C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui
github.com/andlabs/ui
..\github.com\andlabs\ui\area.go:9:17: fatal error: ui.h: No such file or directory // #include "ui.h" ^ compilation terminated. 错误: 进程退出代码 2.
我删除掉这行(// #include "ui.h")后, 提示:
C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui
github.com/andlabs/ui
could not determine kind of name for C.intmax_t could not determine kind of name for C.uiArea could not determine kind of name for C.uiAreaHandler could not determine kind of name for C.uiAreaQueueRedrawAll could not determine kind of name for C.uiAreaSetSize could not determine kind of name for C.uiControl could not determine kind of name for C.uiControlDestroy could not determine kind of name for C.uiControlDisable could not determine kind of name for C.uiControlEnable could not determine kind of name for C.uiControlHandle could not determine kind of name for C.uiControlHide could not determine kind of name for C.uiControlShow could not determine kind of name for C.uiNewArea could not determine kind of name for C.uiNewScrollingArea 错误: 进程退出代码 2.
我liteide 配置如下;
native compiler windows 386
#GOROOT=c:\go
#GOBIN=
#GOARCH=386
#GOOS=windows
#CGO_ENABLED=1
#GO15VENDOREXPERIMENT=1
#PATH=%PATH%;C:\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin;
#LITEIDE_GDB=gdb LITEIDE_MAKE=mingw32-make LITEIDE_TERM=%COMSPEC% LITEIDE_TERMARGS= LITEIDE_EXEC=%COMSPEC% LITEIDE_EXECOPT=/C
求指导。
上面的处理好了, 我把注释去掉就可以了, 但报了这个错, C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui
github.com/andlabs/ui
C:/mingw-w64/x86_64-5.3.0-posix-seh-rt_v4-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lui collect2.exe: error: ld returned 1 exit status 错误: 进程退出代码 2.
求指导。