Is there a windowed setting option for the Go compiler?

那年仲夏 提交于 2020-01-01 09:23:11

问题


I'm using Go (6g) to compile a GTK application and I want to know if there is a compiler/linker option to make it a Windows executable as opposed to console executable. MinGW has a -mwindows option for this and currently I'm having to manually alter the PE header with a hex editor which is annoying.


回答1:


-ldflags 'flag list' arguments to pass on each 5l, 6l, or 8l linker invocation

Compile packages and dependencies

-Hwindowsgui (only in 6l/8l) Write Windows PE32+ GUI binaries

Command ld

Add -ldflags -Hwindowsgui to the go build/get/install command line. For example,

go build -ldflags="-Hwindowsgui" gtkapp.go


来源:https://stackoverflow.com/questions/11391975/is-there-a-windowed-setting-option-for-the-go-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!