go-gl / glfw

Go bindings for GLFW 3
BSD 3-Clause "New" or "Revised" License
1.58k stars 181 forks source link

How to use in windows? #374

Closed everdrone closed 12 months ago

everdrone commented 1 year ago

Is MSYS2 required when using go 1.20?

Trying to build the hello world program from readme.md gives the following errors:

.\main.go:16:14: undefined: glfw.Init
.\main.go:20:13: undefined: glfw.Terminate
.\main.go:22:22: undefined: glfw.CreateWindow
.\main.go:32:8: undefined: glfw.PollEvents
Jacalz commented 1 year ago

You will always need a C-compiler to build this package. I don't think it should be any difference using Go 1.20 as that always was the case. As Go doesn't yet support clang on Windows, I believe you need to use MSYS2 (or similar) and a suitable installation of GCC. The docs for Fyne installation on Windows should be able to help out with installing it as the dependencies are exactly the same.

Per the CGo section in the Go 1.20 release notes, CGO_ENABLED will be disabled unless a C-compiler is installed. I don't think that should change anything here though as we don't have any precompiled C-headers as far as I'm aware.

Jacalz commented 12 months ago

I believe the above comment to answer your problem and will close this issues. Feel free to reopen if you don't agree.