在golang终端中的退出状态3221225477

时间:2020-01-21 10:07:27

标签: windows go

当我尝试运行以下golang代码时,终端中的输出为“退出状态3221225477”。然后程序关闭。我正在使用fyne GUI软件包。您能帮我解决这个问题吗? 包主

import (
"net/url"
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/layout"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
)

func main() {
app := app.New()
app.Settings().SetTheme(theme.LightTheme())
entry := widget.NewEntry()
entry.SetText("Path")

w := app.NewWindow("Hello")

link, err := url.Parse("https://www.inovatian.com/")
if err != nil {
fyne.LogError("Could not parse URL", err)
}

w.SetContent(widget.NewVBox(
widget.NewLabelWithStyle("Welcome to Inovatian App", 
fyne.TextAlignCenter, fyne.TextStyle{Bold: true}),
layout.NewSpacer(),

widget.NewHyperlinkWithStyle("inovatian", link, fyne.TextAlignCenter, 
fyne.TextStyle{}),
layout.NewSpacer(),

widget.NewGroup("",
    fyne.NewContainerWithLayout(layout.NewGridLayout(2),
        widget.NewButton("Next", func() {
            app.Quit()
        }),
        widget.NewButton("Cancel", func() {
            app.Quit()
        }),
      ),
    ),
))
w.CenterOnScreen()
w.Resize(fyne.NewSize(240, 180))
w.ShowAndRun()
}

2 个答案:

答案 0 :(得分:2)

在ubuntu上工作(下面的屏幕截图)。

根据this,十六进制的返回值3221225477为0xC0000005或STATUS_ACCESS_VIOLATION,它们报告为“无效的内存地址或空指针取消引用”。 因此,在Windows版本的Fyne GUI库中可能是一个问题。

This Fyne issue might be related

app screenshot

答案 1 :(得分:1)

您的源代码也可以在macOS Mojave上正常工作。

App

但是,我收到一条警告,指出已在macOS 10.14中将'NSOpenGLContext'明确标记为已弃用。 (这不应在Windows中出现。)

NSOpenGLContext is deprecated

如Mark所说,十六进制的返回值3221225477为0xC0000005(“访问冲突”),表明您的程序已异常终止或崩溃。