veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.17k stars 219 forks source link

could not determine kind of name for C.Mix_OpenAudioDevice #476

Closed EugeneGlevsky closed 3 years ago

EugeneGlevsky commented 3 years ago

Ubuntu 16.04 try to use this example: https://github.com/veandco/go-sdl2-examples/tree/4298a5894b3ec15532eb78de70c71a528095865e/examples/audio_wav_memory and get an error:

# github.com/veandco/go-sdl2/mix
../extgo/src/github.com/veandco/go-sdl2/mix/sdl_mixer.go:162:5: could not determine kind of name for C.Mix_OpenAudioDevice

How can I fix it?

EugeneGlevsky commented 3 years ago

I read in the source that: Mix_OpenAudioDevice is not supported before SDL 2.0.9 I am installed this, my sdl2-config --version shows: 2.0.9 but this error still exists. Any ideas?

veeableful commented 3 years ago

Hi @EugeneGlevsky, what does pkg-config --cflags sdl2 print? Could you use the printed include directory to find SDL_version.h and verify that the version is at least 2.0.9?

EugeneGlevsky commented 3 years ago

pkg-config --cflags sdl2 return: -D_REENTRANT -I/usr/include/SDL2 I fount SDL_version.h and open, in the source I can see: SDL_MAJOR_VERSION 2 SDL_PATCHLEVEL 9

But if I try to run: sudo apt install libsdl2-mixer-dev it says: is already the newest version (2.0.1+dfsg1-1)

In the current moment I comment this function in source code and it is compiling without errors and working. But I want to fix it without this way.

veeableful commented 3 years ago

Ahh sorry, it appears the message was wrong. It needs SDL2_mixer 2.0.2. I will correct it right away.

EugeneGlevsky commented 3 years ago

@veeableful Thank you so much. I make pull in my version from git and now I can see this:

# github.com/veandco/go-sdl2/mix ../extgo/src/github.com/veandco/go-sdl2/mix/sdl_mixer.go:28:32: error: missing binary operator before token "(" //#if !(SDL_MIXER_VERSION_ATLEAST(2,0,2))

veeableful commented 3 years ago

Hmm perhaps the Go version is out of date. Could you tell me which version is your Go toolchain?

EugeneGlevsky commented 3 years ago

go version go1.15.6 linux/amd64

veeableful commented 3 years ago

Ahh I think it must be the gcc version then. Could you try installing newer GCC? I'm using GCC 10 and the problem doesn't appear to me.

EugeneGlevsky commented 3 years ago

Ok, thank you so much!