2015-11-02 39 views
-5

我想为“发布”制作一个Golang文件。如何为“发布”创建go文件?

这是我的命令:

go build -o testi.exe -ldflags "-H windowsgui" 

什么是正确的方法是什么?我的代码:

package main 
import (
    "fmt" 
    "os" 
    //"github.com/chai2010/qml" 
    "github.com/go-qml/qml" 
) 
func main() { 
    if err := qml.Run(run); err != nil { 
     fmt.Fprintf(os.Stderr, "error: %v\n", err) 
     os.Exit(1) 
    } 
} 
func run() error { 
    engine := qml.NewEngine() 
    engine.On("quit", func() { os.Exit(0) }) 

    component, err := engine.LoadString("hello.qml", qmlHello) 
    if err != nil { 
     return err 
    } 
    window := component.CreateWindow(nil) 
    window.Show() 
    window.Wait() 
    return nil 
} 

const qmlHello = ` 
import QtQuick 2.2 
import QtQuick.Controls 1.1 
Rectangle { 
    id: page 
    width: 320; height: 240 
    color: "lightgray" 
    Text { 
     id: helloText 
     text: "Hello world!" 
     y: 30 
     anchors.horizontalCenter: page.horizontalCenter 
     font.pointSize: 24; font.bold: true 
    } 
} 
` 

我安装了:go1.5.windows-386。

+0

你是什么意思的“为”发布“'? – JimB

+0

在C++中有两种模式:Release和Debug.example:在qt和C++中 程序是25.0 KB的“release”和调试:850 KB。 – ravandi

+0

这可能意味着在你的IDE中,但这不是一个C++的东西。如果您没有专门针对“发行版”进行特别配置的任何内容,我不确定您期望为“发行版”创建不同的版本。与DLL – JimB

回答

0

正如JimB,戴夫·切尼解释说,和其他人:

  • 没有 “释放” Golang
  • Golang可执行文件都很大,这是normal
  • 是的,你必须提供给如果强制链接共享库,DLL文件
  • 是的,这些库可能很大。
  • 没有什么错,只是放手使用默认值
+0

我已经创建了发布文件。 但是现在在另一台电脑上有问题。 go文件现在不在另一台计算机上执行。 – ravandi

+0

问题解决了。我使用了以下程序: procmon.exe – ravandi

相关问题