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 5126 - MinGW compile error SDL_windowssensor.c
Summary: MinGW compile error SDL_windowssensor.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows (All)
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-06 09:56 UTC by Martin Gerhardy
Modified: 2020-06-17 17:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Gerhardy 2020-05-06 09:56:48 UTC
SDL_windowssensor.c includes InitGuid.h - but it should be initguid.h
Comment 1 Martin Gerhardy 2020-05-06 09:57:49 UTC
The same is true for the other two windows headers that are following. Should all be lowercase.
Comment 2 Martin Gerhardy 2020-05-06 09:58:51 UTC
sdl2/src/sensor/windows/SDL_windowssensor.c:39:13: error: redefinition of 'CLSID_SensorManager'
   39 | DEFINE_GUID(CLSID_SensorManager, 0x77A1C827, 0xFCD2, 0x4689, 0x89, 0x15, 0x9D, 0x61, 0x3C, 0xC5, 0xFA, 0x3E);
      |             ^~~~~~~~~~~~~~~~~~~
/usr/src/mxe/usr/x86_64-w64-mingw32.static/include/sensorsapi.h:1221:1: note: previous definition of 'CLSID_SensorManager' was here
 1221 | DEFINE_GUID(CLSID_SensorManager, 0x77a1c827, 0xfcd2, 0x4689, 0x89,0x15, 0x9d,0x61,0x3c,0xc5,0xfa,0x3e);
      | ^~~~~~~~~~~
sdl2/src/sensor/windows/SDL_windowssensor.c: In function 'SDL_WINDOWS_SensorInit':
sdl2/src/sensor/windows/SDL_windowssensor.c:354:97: warning: passing argument 5 of 'CoCreateInstance' from incompatible pointer type [-Wincompatible-pointer-types]
  354 |     hr = CoCreateInstance(&CLSID_SensorManager, NULL, CLSCTX_INPROC_SERVER, &IID_SensorManager, &SDL_sensor_manager);
      |                                                                                                 ^~~~~~~~~~~~~~~~~~~
      |                                                                                                 |
      |                                                                                                 ISensorManager ** {aka struct ISensorManager **}
In file included from /usr/src/mxe/usr/x86_64-w64-mingw32.static/include/objbase.h:14,
                 from /usr/src/mxe/usr/x86_64-w64-mingw32.static/include/ole2.h:17,
                 from /usr/src/mxe/usr/x86_64-w64-mingw32.static/include/sensorsapi.h:12,
                 from sdl2/src/sensor/windows/SDL_windowssensor.c:36:
/usr/src/mxe/usr/x86_64-w64-mingw32.static/include/combaseapi.h:256:108: note: expected 'void **' but argument is of type 'ISensorManager **' {aka 'struct ISensorManager **'}
  256 | WINOLEAPI CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);
      |                                                                                                    ~~~~~~~~^~~
Comment 3 Martin Gerhardy 2020-05-06 10:01:17 UTC
Built via https://github.com/dockcross/dockcross

docker run --rm dockcross/windows-static-x64:latest > ./dockcross                                                                                             
chmod +x ./dockcross
mv ./dockcross ~/bin

dockcross cmake ....
Comment 4 Martin Gerhardy 2020-06-17 16:19:23 UTC
Most of the issues where already fixed by Ryan, only the lowercase header files are left.

diff --git a/contrib/libs/sdl2/src/sensor/windows/SDL_windowssensor.c b/contrib/libs/sdl2/src/sensor/windows/SDL_windowssensor.c
index f28b63518..efb7e3fcf 100644
--- a/contrib/libs/sdl2/src/sensor/windows/SDL_windowssensor.c
+++ b/contrib/libs/sdl2/src/sensor/windows/SDL_windowssensor.c
@@ -32,9 +32,9 @@
 #include "../../core/windows/SDL_windows.h"
 
 #define COBJMACROS
-#include <InitGuid.h>
-#include <SensorsApi.h>
-#include <Sensors.h>
+#include <initguid.h>
+#include <sensorsapi.h>
+#include <sensors.h>
Comment 5 Sam Lantinga 2020-06-17 17:09:35 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/b622185b81ce