We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1659

Summary: testgamecontroller.c does not build on SDL without Joystick/Haptic support
Product: SDL Reporter: Andreas Schiffler <aschiffler>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Windows 7   

Description Andreas Schiffler 2012-12-10 17:05:26 UTC
When SDL is build without Joystick/Haptic (i.e. I tend to have to do this on Windows with cygwin/mingw32: ../configure --disable-joystick --disable-haptic) the tests don't build anymore.
 
One probably needs to define some stubs in SDL for the missing functions (and add some detection in testgamecontroller.c so it doesn't run).

gcc -o testgamecontroller.exe testgamecontroller.c -g -O2
-I/usr/local/include/SDL2 -I/usr/include/mingw -mno-cygwin 
-Dmain=SDL_main -DHAVE_OPENGL -L/usr/local/lib -lmingw32 -lSDL2main
-lSDL2 -mno-cygwin -mwindows
/tmp/ccQ0QJSS.o: In function `WatchGameController':
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:73: undefined 
reference to `_SDL_GameControllerName'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:113: undefined 
reference to `_SDL_GameControllerGetButton'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:122: undefined 
reference to `_SDL_GameControllerGetAxis'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:130: undefined 
reference to `_SDL_GameControllerGetAxis'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:147: undefined 
reference to `_SDL_GameControllerGetAttached'
/tmp/ccQ0QJSS.o: In function `SDL_main':
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:170: undefined 
reference to `_SDL_NumJoysticks'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:171: undefined 
reference to `_SDL_IsGameController'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:170: undefined 
reference to `_SDL_NumJoysticks'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:174: undefined 
reference to `_SDL_GameControllerNameForIndex'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:183: undefined 
reference to `_SDL_GameControllerOpen'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:193: undefined 
reference to `_SDL_GameControllerClose'
collect2: ld returned 1 exit status
Makefile:92: recipe for target `testgamecontroller.exe' failed
make: *** [testgamecontroller.exe] Error 1

On 12/10/2012 3:46 PM, Sam Lantinga wrote:
> For some reason when the haptic and joystick subsystems are disabled the code is explicitly excluded from the build.  This isn't the case for the audio and video subsystems.  I'll have to look into why that was done at some point.  I think the original idea was that disabling a subsystem completely excised the API, but then later that was revised to just stubbing the API and the joystick and haptic code wasn't updated.
>
> testjoystick suffers from the same problem and I think always has.
Comment 1 Sam Lantinga 2012-12-31 16:32:41 UTC
Andreas fixed this by checking for disabled systems in the test programs