问题描述

我创建了一个我想在后台运行的应用程序(无命令/ cmd控制台)。



(这适用于Windows,在Windows 7 Pro 64位测试)

在网上找到的文档说,我可以编译一些类似

的代码:

 go build -ldflags -Hwindowsgui filename.go 


未知标志-Hwindowsgui 


对于更新版本的编译器,这应该可以工作:



 go build -ldflags -H = windowsgui filename.go 


当我继续搜索时,我发现一个注意,官方文档应该更新很快,但在此期间有很多旧式的示例答案有那个错误。

I created an application that I want to run invisibly in the background (no command / cmd console). How do I do this?

(This is for Windows, tested on Windows 7 Pro 64 bit)

The documentation found online says I can compile with something along the lines of,

go build -ldflags -Hwindowsgui filename.go
unknown flag -Hwindowsgui

With more recent (1.1?) versions of the compiler, this should work:

go build -ldflags -H=windowsgui filename.go

When I continued searching around I found a note that the official documentation should be updated soon, but in the meantime there are a lot of older-style example answers out there that error.

这篇关于如何从Golang创建一个不打开命令(cmd)窗口运行时的可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!