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

SDL2_framerate.h not such file or directory

Open piotao opened this issue 2 years ago • 4 comments

System: MX Linux 21 SDL2 installed and files in /usr/include/SDL2 exists (see attached file with ls -R - zipped)

Steps to reproduce in $HOME/go/src/esdeel directory: 0. go mod init

  1. Write a simple program for SDL2 testing (attached main.go in zip)
  2. go get github.com/veandco/go-sdl2/sdl (no errors)
  3. go get github.com/veandco/go-sdl2/gfx (no errors)
  4. go build (or go run, doesn't matter)

Error: esdeel$ go build .

github.com/veandco/go-sdl2/gfx

In file included from ../../pkg/mod/github.com/veandco/[email protected]/gfx/sdl_gfx.go:5: ./sdl_gfx_wrapper.h:8:11: fatal error: SDL2_framerate.h: No such file or directory 8 | #include <SDL2_framerate.h> | ^~~~~~~~~~~~~~~~~~ compilation terminated.

HOW I FIXED THAT:

  1. Opened file ~/go/pkg/mod/github.com/veandco/[email protected]/gfx/sdl_gfx_wrapper.h and manually changed linux includes from default <SDL2_framerate.h> to their direct paths: #include "/usr/include/SDL2/SDL2_framerate.h" etc.
  2. Changed file is included.
  3. This worked, and now I have graphics window which draws lines. I assume this fix is working! :) File is included in zip file too.

files.zip

piotao avatar Apr 12 '23 20:04 piotao

Hi @piotao, we rely on pkg-config --cflags sdl2 to find the SDL2 include directory. I wonder if MX Linux doesn't provide it or SDL2's pkgconfig directory is not in PKG_CONFIG_PATH environment variable?

veeableful avatar Apr 14 '23 06:04 veeableful

Shouldn't this be pkg-config --cflags SDL2_gfx in that case?

hfiguiere avatar May 15 '24 01:05 hfiguiere

SDL2_framerate.h comes with SDL2_gfx so that's the package that should be checked for that header.

hfiguiere avatar May 15 '24 01:05 hfiguiere

Hi @hfiguiere, thank you for the suggestion. I have updated the pkg-config to use sdl2_gfx in the v0.4.39 tag.

veeableful avatar May 18 '24 05:05 veeableful