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 2831

Summary: Compiler error with haptics when missing Direct X & xinput on windows
Product: SDL Reporter: sirGustav <sir.gustav.the.coder>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: don't know   
Hardware: x86_64   
OS: Windows 8   

Description sirGustav 2014-12-30 15:03:28 UTC
Using the latest checkout: SDL-b7873b036fe7

  DIRECTX                (Wanted: OFF): OFF
  Haptic:	ON
SDL_windowshaptic_c.h(62): error C2016: C requires that a struct or union has at least one member

I have neither dinput nor xinput installed.

I changed CMakeLists.txt around line 1016 to:

if(SDL_HAPTIC)
  file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c)
  set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
  set(HAVE_SDL_HAPTIC_DATA FALSE)
  if(HAVE_DINPUT_H)
	set(SDL_HAPTIC_DINPUT 1)
	set(HAVE_SDL_HAPTIC_DATA TRUE)
  endif()
  if(HAVE_XINPUT_H)
	set(SDL_HAPTIC_XINPUT 1)
	set(HAVE_SDL_HAPTIC_DATA TRUE)
  endif()
  if(NOT HAVE_SDL_HAPTIC_DATA)
	message(FATAL_ERROR "Unable to find xinput/dinput headers")
  endif()
  set(HAVE_SDL_HAPTIC TRUE)
endif()

At least this keeps cmake from generating a bad build.
Comment 1 sirGustav 2014-12-31 01:39:53 UTC
It seems that directx (with dinput and xinput) is included with my compiler(msvs 2013) http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275%28v=vs.85%29.aspx and CMake isn't picking up on that.

Changing the check_include_file to find_path commands instead fixed CMake to find the correct headers but there appears to be some big api changes but I'm not really familiar with neither dinput nor xinput so I can't really tell.