doutuo7126 2015-11-02 18:20
浏览 35

如何为“发行”创建go文件?

I want to make a Golang File For "Release".

This is my command:

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

What is the correct way? My code:

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
", 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
    }
}
`

I installed : go1.5.windows-386.

  • 写回答

1条回答 默认 最新

  • douquejituan938904 2015-11-20 21:06
    关注

    As explained by JimB, Dave Cheney, and others:

    • There is no "RELEASE" for Golang
    • Golang executables are large, that is normal
    • Yes, you have to provide to DLL files if you force linking shared libraries
    • Yes, those libraries might be large.
    • There is nothing wrong, just let go use the defaults
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类