Open vtf6259 opened 11 months ago
Hi @vtf6259, could you show me how you build the code that generated the error?
@veeableful it is go build main.go
and i do go mod tidy
to install go-sdl2
Thanks @vtf6259! Would it compile if you remove usage of ttf
from the code? Perhaps put only sdl.Delay(16)
in the main()
function.
Oh and how did you install SDL2 and SDL2_ttf? Are you using MinGW?
@veeableful to install SDL2 and SDL2_ttf i use go mod tidy
Oh that wouldn't install SDL2 and SDL2_ttf. They are separate, required packages that go-sdl2 depends on. I'm not sure if the following will work on Windows 11 but perhaps you can try it.
On Windows,
mingw64
, into C:\
.SDL2-devel-[version]-mingw.zip
files from https://github.com/libsdl-org/SDL/releases.
i686-w64-mingw32
and/or x86_64-w64-mingw32
into mingw64 folder e.g. C:\mingw64
Path
environment variable
Path
environment variable (e.g. C:\mingw64\bin
)Path
environment variable takes effect. Now we should be able to run go build
inside the project directory..dll
file into the project directory. After that, the program should become runnable.
Go version: go1.20.6 Go-SDL2 version: 0.4.35 SDL2 version: N/A OS: Windows 11 Architecture: x64 When i run my go-sdl2 code i get the error:" github.com/veandco/go-sdl2/ttf: build constraints exclude all Go files in C:\Users\vtf62\go\pkg\mod\github.com\veandco\go-sdl2@v0.4.35\ttf " and my code is ```go package main
import ( "fmt" "os"
)
func run() error { err := sdl.Init(sdl.INIT_EVERYTHING) if err != nil { return fmt.Errorf("failed to initialize SDL: %v", err) } defer sdl.Quit()
}
func main() { err := run() if err != nil { fmt.Fprintf(os.Stderr, "%v", err) os.Exit(1) } }