SDL icon indicating copy to clipboard operation
SDL copied to clipboard

[Emscripten] testcontroller error and checkkeys warning

Open Sackzement opened this issue 3 months ago • 3 comments

I tried compiling SDL with Emscripten following the README-emscripten.md documentation.

Building SDL and examples work.

But building the tests fails:

[ 50%] Building C object test/CMakeFiles/checkkeys.dir/checkkeys.c.o
/path/to/SDL-git/test/checkkeys.c:237:17: warning: incompatible pointer types initializing 'const bool *' with an expression of type 'const unsigned char *' [-Wincompatible-pointer-types]
  237 |     const bool *keystate = SDL_GetKeyboardState(&max_keys);
      |                 ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 75%] Building C object test/CMakeFiles/testcontroller.dir/testcontroller.c.o
/path/to/SDL-git/test/testcontroller.c:1175:17: error: incompatible function pointer types assigning to 'unsigned char (*)(void *, Uint16, Uint16)' (aka 'unsigned char (*)(void *, unsigned short, unsigned short)') from 'bool (void *, Uint16, Uint16)' (aka 'bool (void *, unsigned short, unsigned short)') [-Wincompatible-function-pointer-types]
 1175 |     desc.Rumble = VirtualGamepadRumble;
      |                 ^ ~~~~~~~~~~~~~~~~~~~~
/path/to/SDL-git/test/testcontroller.c:1176:25: error: incompatible function pointer types assigning to 'unsigned char (*)(void *, Uint16, Uint16)' (aka 'unsigned char (*)(void *, unsigned short, unsigned short)') from 'bool (void *, Uint16, Uint16)' (aka 'bool (void *, unsigned short, unsigned short)') [-Wincompatible-function-pointer-types]
 1176 |     desc.RumbleTriggers = VirtualGamepadRumbleTriggers;
      |                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/SDL-git/test/testcontroller.c:1177:17: error: incompatible function pointer types assigning to 'unsigned char (*)(void *, Uint8, Uint8, Uint8)' (aka 'unsigned char (*)(void *, unsigned char, unsigned char, unsigned char)') from 'bool (void *, Uint8, Uint8, Uint8)' (aka 'bool (void *, unsigned char, unsigned char, unsigned char)') [-Wincompatible-function-pointer-types]
 1177 |     desc.SetLED = VirtualGamepadSetLED;
      |                 ^ ~~~~~~~~~~~~~~~~~~~~

Because of the bool/unsigned char mismatch, my guess is that SDL was built with C, but the tests are built with C++.

Sackzement avatar Nov 11 '24 02:11 Sackzement