Closed Peternj42 closed 9 months ago
Hi @Peternj42, could you show what's in your PATH
?
Fixed! Taking a closer look at my Path I found a different version of gcc in another directory higher up in PATH. Go must have found that one first, then the relative paths to SDL wouldn't work. Removed the other gcc from PATH and it works now. Thanks!
Go version: 1.21.1 Go-SDL2 version: 0.4.35 SDL2 version: 2.28.3 OS: Windows Architecture: amd64
I installed go-sdl2, mingw and sdl2 for windows per the instructions and added them to PATH. In the editor everything appears to be working - the import paths are resolved and I'm able to get code completion for the go-sdl2 package, but when I build, I get this error:
In file included from C:\Users\peter\go\pkg\mod\github.com\veandco\go-sdl2@v0.4.35\sdl\audio.go:4: ./sdl_wrapper.h:2:11: fatal error: SDL2/SDL.h: No such file or directory 2 | #include <SDL2/SDL.h> | ^
~~~I've reviewed the other issues that have gotten similar errors but have not been able to get their solutions to work. I found that by changing the include in audio.go to the absolute path resolves the error for that file:
include "C:/Program Files (x86)/mingw64/x86_64-w64-mingw32/include/SDL2/SDL.h"
but it looks like I would have to do this to every #include statement in every .go file, so I think I must be doing something wrong. I've double checked the installed files and the path variables but can't figure out why the compiler can't find the .h files. Any help would be appreciated. Thanks!
EDIT: I was able to compile successfully with:
go build -tags static -ldflags "-s -w"
but a standard go build gives the above error