我fyne
通过运行以下命令进行安装:
go get fyne.io/fyne/v2@latest
go install fyne.io/fyne/v2/cmd/fyne@latest
一切都安装得很完美。
运行这个简单的应用程序时:
package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello World")
w.SetContent(widget.NewLabel("Hello World!"))
w.ShowAndRun()
}
该命令go run .
产生了此错误:
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\driver\glfw\driver_desktop.go:18:2: missing go.sum entry for module providing package fyne.io/systray (imported by fyne.io/fyne/v2/internal/driver/glfw); to add:
go get fyne.io/fyne/v2/internal/driver/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\storage\repository\parse.go:9:2: missing go.sum entry for module providing package github.com/fredbi/uri (imported by fyne.io/fyne/v2/storage/repository); to add:
go get fyne.io/fyne/v2/storage/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\app\settings_desktop.go:11:2: missing go.sum entry for module providing package github.com/fsnotify/fsnotify (imported by fyne.io/fyne/v2/app); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\driver\glfw\driver.go:12:2: missing go.sum entry for module providing package github.com/fyne-io/image/ico (imported by fyne.io/fyne/v2/internal/driver/glfw); to add:
go get fyne.io/fyne/v2/internal/driver/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\gl\gl_core.go:9:2: missing go.sum entry for module providing package github.com/go-gl/gl/v2.1/gl (imported by fyne.io/fyne/v2/internal/painter/gl); to add:
go get fyne.io/fyne/v2/internal/painter/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\driver\glfw\clipboard.go:12:2: missing go.sum entry for module providing package github.com/go-gl/glfw/v3.3/glfw (imported by fyne.io/fyne/v2/internal/driver/glfw); to add:
go get fyne.io/fyne/v2/internal/driver/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\font.go:11:2: missing go.sum entry for module providing package github.com/go-text/render (imported by fyne.io/fyne/v2/internal/painter); to add:
go get fyne.io/fyne/v2/internal/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\font.go:12:2: missing go.sum entry for module providing package github.com/go-text/typesetting/di (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\font.go:13:2: missing go.sum entry for module providing package github.com/go-text/typesetting/font (imported by fyne.io/fyne/v2/internal/painter); to add:
go get fyne.io/fyne/v2/internal/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\font.go:14:2: missing go.sum entry for module providing package github.com/go-text/typesetting/shaping (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\svg\svg.go:16:2: missing go.sum entry for module providing package github.com/srwiley/oksvg (imported by fyne.io/fyne/v2/internal/svg); to add:
go get fyne.io/fyne/v2/internal/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\svg\svg.go:17:2: missing go.sum entry for module providing package github.com/srwiley/rasterx (imported by fyne.io/fyne/v2/internal/painter); to add:
go get fyne.io/fyne/v2/internal/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\widget\markdown.go:8:2: missing go.sum entry for module providing package github.com/yuin/goldmark (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\widget\markdown.go:9:2: missing go.sum entry for module providing package github.com/yuin/goldmark/ast (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\widget\markdown.go:10:2: missing go.sum entry for module providing package github.com/yuin/goldmark/renderer (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\image.go:8:2: missing go.sum entry for module providing package golang.org/x/image/draw (imported by fyne.io/fyne/v2/internal/painter); to add:
go get fyne.io/fyne/v2/internal/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\painter\draw.go:10:2: missing go.sum entry for module providing package golang.org/x/image/math/fixed (imported by fyne.io/fyne/v2/widget); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\app\app_windows.go:14:2: missing go.sum entry for module providing package golang.org/x/sys/execabs (imported by fyne.io/fyne/v2/app); to add:
go get fyne.io/fyne/v2/[email protected]
C:\Users\Николай\go\pkg\mod\fyne.io\fyne\[email protected]\internal\driver\glfw\window_windows.go:11:2: missing go.sum entry for module providing package golang.org/x/sys/windows/registry (imported by fyne.io/fyne/v2/app); to add:
go get fyne.io/fyne/v2/[email protected]
通过运行命令可以修复此问题(如错误消息中所述):
go get fyne.io/fyne/v2/[email protected]
但是当我启动这个应用程序时,这个错误再次显示,我无法以任何方式解决:
# github.com/go-gl/glfw/v3.3/glfw
In file included from C:\Users\Николай\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]\c_glfw.go:4:
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c: In function 'glfwSwapBuffers':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c:644:1: error: converting to execution character set: Illegal byte sequence
644 | assert(window != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c: In function 'glfwExtensionSupported':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c:678:1: error: converting to execution character set: Illegal byte sequence
678 | assert(extension != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c: In function 'glfwGetProcAddress':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/context.c:744:1: error: converting to execution character set: Illegal byte sequence
744 | assert(procname != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Николай\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]\c_glfw.go:6:
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/input.c: In function 'glfwGetInputMode':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/input.c:492:1: error: converting to execution character set: Illegal byte sequence
492 | assert(window != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
...
<Здесь что-то такое же.>
...
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c: In function 'glfwSetWindowContentScaleCallback':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c:1061:1: error: converting to execution character set: Illegal byte sequence
1061 | assert(window != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c: In function 'glfwWaitEventsTimeout':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c:1083:1: error: converting to execution character set: Illegal byte sequence
1083 | assert(timeout == timeout);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c:1084:1: error: converting to execution character set: Illegal byte sequence
1084 | assert(timeout >= 0.0);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/window.c:1085:1: error: converting to execution character set: Illegal byte sequence
1085 | assert(timeout <= DBL_MAX);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Николай\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]\c_glfw.go:10:
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c: In function '_glfwCreateContextOSMesa':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:224:1: error: converting to execution character set: Illegal byte sequence
224 | setAttrib(OSMESA_FORMAT, OSMESA_RGBA);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:225:1: error: converting to execution character set: Illegal byte sequence
225 | setAttrib(OSMESA_DEPTH_BITS, fbconfig->depthBits);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:226:1: error: converting to execution character set: Illegal byte sequence
226 | setAttrib(OSMESA_STENCIL_BITS, fbconfig->stencilBits);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:227:1: error: converting to execution character set: Illegal byte sequence
227 | setAttrib(OSMESA_ACCUM_BITS, accumBits);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:231:1: error: converting to execution character set: Illegal byte sequence
231 | setAttrib(OSMESA_PROFILE, OSMESA_CORE_PROFILE);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:235:1: error: converting to execution character set: Illegal byte sequence
235 | setAttrib(OSMESA_PROFILE, OSMESA_COMPAT_PROFILE);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:240:1: error: converting to execution character set: Illegal byte sequence
240 | setAttrib(OSMESA_CONTEXT_MAJOR_VERSION, ctxconfig->major);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:241:1: error: converting to execution character set: Illegal byte sequence
241 | setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:251:1: error: converting to execution character set: Illegal byte sequence
251 | setAttrib(0, 0);
| ^ ~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c: In function 'glfwGetOSMesaColorBuffer':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:303:1: error: converting to execution character set: Illegal byte sequence
303 | assert(window != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c: In function 'glfwGetOSMesaDepthBuffer':
C:\Users\�������\go\pkg\mod\github.com\go-gl\glfw\v3.3\[email protected]/glfw/src/osmesa_context.c:342:1: error: converting to execution character set: Illegal byte sequence
342 | assert(window != NULL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
此外,出现此错误后,程序不会停止工作,您必须通过按Ctrl+来终止它C。