Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error LNK2001: unresolved external symbol SDL_JoystickGetDeviceInstanceID #153

Closed
heeeeeeeeeeh opened this issue Mar 24, 2024 · 1 comment

Comments

@heeeeeeeeeeh
Copy link

On the sdl2 branch in libsdl-org/SDL there is a function SDL_JoystickGetDeviceInstanceID in joystick.h. I don't see it in the version of sdl2 the pygame_sdl_windeps repo has which is why the build fails. Is a newer version of SDL needed for the build to work?

@yg195329
Copy link

I just ran into the same issue. I am not the maintainer, but I looked into it and managed to get pygame_sdl2 to compile successfully. Your analysis is correct, but SDL_JoystickGetDeviceInstanceID is only the beginning of the problems. The various commits made to this repo require other symbols that are also missing from renpy/pygame_sdl2_windeps.

Here is what I did on Windows in case it is useful to anyone:

  1. Git clone renpy/pygame_sdl2 and add renpy/pygame_sdl2_windeps as a submodule.
  2. Download SDL2-devel-2.0.14-VC from https://www.libsdl.org/release/ and move it inside the pygame_sdl2/pygame_sdl2_windeps directlry.
  3. Run "python ./unpack.py SDL2-devel-2.0.14-VC.zip" from the pygame_sdl2/pygame_sdl2_windeps directory. This will overwrite all the relevant files in the include/ and lib/ subdirectories
  4. (optional) Depending on your compiler, you may run into an unrelated error with src/SDL_gfxPrimitives.c. Recent versions of MSVC define lrint() as an intrinsic function whereas the #ifdef pragma assumes this function to be missing for that compiler. Ideally, the pragma should be updated to check the version number. If all you care is creating a new binary and not committing any changes, I suggest simply removing the entire #ifdef block.
  5. Rerun "python setup.py install" in the pygame_sdl2 directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants