go-sdl2 icon indicating copy to clipboard operation
go-sdl2 copied to clipboard

What am I doing wrong?

Open Keyn1 opened this issue 2 years ago • 1 comments

If I compile a program with "github.com/veandco/go-sdl2/sdl "then everything is ok. The program is compiled. If I insert "github.com/veandco/go-sdl2/ttf " then I get an error

C:\GoPrg\sdl2_start>go build main.go # github.com/veandco/go-sdl2/ttf In file included from C:\Users\Keyn\go\pkg\mod\github.com\veandco\[email protected]\ttf\sdl_ttf.go:6: ./sdl_ttf_wrapper.h:2:18: fatal error: SDL2/SDL_ttf.h: No such file or directory 2 | #include <SDL2/SDL_ttf.h> | ^~~~~~~~~~~~~~~~ compilation terminated.

the file exists C:\Users\Keyn\go\pkg\mod\github.com\veandco\[email protected]\include\SDL2\SDL_ttf.h

How to solve the problem?

Keyn1 avatar May 30 '22 18:05 Keyn1

Hi @Keyn1, I think that is because SDL2_ttf is not installed in the Windows environment. You can download the runtime library here and the header file from the source code here. They can be put in the same location as the SDL2 that you have installed.

Alternatively, you could try running the static compilation build that has been tested to work in Linux. It would use our included, pre-compiled SDL2 libraries using go build -tags static -ldflags="-s -w" on Windows. I tested running it using Git Bash and it seems to work.

veeableful avatar May 31 '22 06:05 veeableful