go-gtk icon indicating copy to clipboard operation
go-gtk copied to clipboard

Building on Windows with -H windowsgui linker flag

Open pztrn opened this issue 8 years ago • 6 comments

Tried to build URTrator (https://github.com/pztrn/urtrator) on windows under MSYS2-MINGW64, everything went fine, except it won't launch if build command was go build -ldflags "-H windowsgui" -v. This linker flag is needed to hide console. The error was "Unspecified fatal error encountered". Any ideas how to fix it?

pztrn avatar Oct 08 '16 18:10 pztrn

I could build example/demo on go tip. What version of go do you use?

mattn avatar Oct 09 '16 05:10 mattn

go version go1.7.1 windows/amd64

Indeed demo launched okay, but only if I launching it from MSYS2 console (as well as URTrator). If I launch it from explorer (of course in directory with copied GTK+2 libraries) - I still have "Unspecified fatal error encountered".

The only way I found is to use this package to hide console with syscall: https://github.com/couchbase/goutils/blob/master/platform/console_windows.go

pztrn avatar Oct 09 '16 12:10 pztrn

As far as I see the google search, this is related gtk/windows. Sorry I have no idea to fix this.

The only way I found is to use this package to hide console with syscall:

Or one-liner

syscall.NewLazyDLL("kernel32").NewProc("FreeConsole").Call()

mattn avatar Oct 09 '16 13:10 mattn

Yea, I know about this oneliner, just need a quickfix yesterday :)

BTW, maybe this should be added to README?

pztrn avatar Oct 09 '16 13:10 pztrn

I think so. if you are okay, could you please send me pull-request to update README?

mattn avatar Oct 09 '16 13:10 mattn

Yes, I'll make a PR today :)

pztrn avatar Oct 10 '16 16:10 pztrn