Skip to main content

Golang Windows


# CGO 交叉编译GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build main.go
# ICON# ==========# 生成 sysogo get rsrc [-manifest FILE.exe.manifest] [-ico FILE.ico[,FILE2.ico...]] -o FILE.sysorsrc -manifest main.exe.manifest -ico pkg/icon/icon.ico -o cmd/launcher/main.syso
# 支持版本等详细信息go get -icon=pkg/icon/icon.ico -manifest=main.exe.manifest -o cmd/launcher/main.syso


<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity    version=""    processorArchitecture="x86"    name="controls"    type="win32"></assemblyIdentity><dependency>    <dependentAssembly>        <assemblyIdentity            type="win32"            name="Microsoft.Windows.Common-Controls"            version=""            processorArchitecture="*"            publicKeyToken="6595b64144ccf1df"            language="*"        ></assemblyIdentity>    </dependentAssembly></dependency></assembly>


import ""
func hideConsole() {    console := w32.GetConsoleWindow()    if console == 0 {        return // no console attached    }    // If this application is the process that created the console window, then    // this program was not compiled with the -H=windowsgui flag and on start-up    // it created a console along with the main application window. In this case    // hide the console window.    // See    //    _, consoleProcID := w32.GetWindowThreadProcessId(console)    if w32.GetCurrentProcessId() == consoleProcID {        w32.ShowWindowAsync(console, w32.SW_HIDE)    }}


is incompatible with i386:x86-64 output .rsrc merge failure: corrupt .rsrc section#

  • 添加 -64 参数