SDL 2.0 compilation with Visual Studio 2015

rotanov wrote:

The first post errors occurred on Windows 7 system with Visual Studio 2015.
On another system (Windows 8 Visual Studio 2015) I got lots of those:

Severity Code Description Project File Line
Error C2011 ‘_XINPUT_BATTERY_INFORMATION’: ‘struct’ type redefinition [D:\dev\engine\build\sdl\src\sdl-build\SDL2.vcxproj] sdl d:\dev\engine\3rd\sdl\src\core\windows\SDL_xinput.h 122

Maybe related to this commit https://github.com/spurious/SDL-mirror/commit/bf785c766bdcdf6ad498123ae80d132a7192b10d

I can’t speak definitively on the Win7 error. It kind-of looks like you might be mixing debug-mode and release-mode SDL dlls, but I could be wrong there.

On the Win8 error, that looks like it might be a bug in SDL, one where the commit you referenced (also referenced on the official SDL hg server, via https://hg.libsdl.org/SDL/rev/26b595dea221 ), caused builds against certain versions of the Windows SDK to fail. I get the same error on WinRT, after having updated one of my own repos to the latest SDL code (from hg.libsdl.org). From briefly looking at the copy of the Windows SDK I have, it looks like the Win8+ SDKs have a few identical type declarations, which MSVC is unable to reliably resolve.

If I can find time in the next few weeks, I can take a stab at providing a patch (to Sam, Ryan, etc.), but make no guarantees. I don’t have an actively-working Win7 dev system anymore though, so I wouldn’t be able to test building there. :expressionless:

– David L.

DLudwig wrote:

If I can find time in the next few weeks, I can take a stab at providing a patch (to Sam, Ryan, etc.), but make no guarantees. I don’t have an actively-working Win7 dev system anymore though, so I wouldn’t be able to test building there. :expressionless:

I came up with a quick, largely-untested patch just now. I’ve only tested it on WinRT though. Feel free to give it a shot wherever. I suspect it may work on Win32 + MSVC 2015, but I make no guarantees on that.

Cheers,
– David L.

Yeah, best way to fix it is to compile the source yourself since Visual Studio 2015 made changes that broke several Visual Studio builds (anything prior to VS2015 that is). I know because I had to contend with errors like that popping up.

Hopefully, a precompiled Visual Studio 2015 build becomes available for those who don’t want to compile it themselves.

I’ve decided to go ahead and redistribute a working Visual Studio 2015 Multi-Threaded Build (32-bit x86). It is actually compiled as a DLL (only tweaked the code generation setting), but should not require any Visual C++ 2015 Runtime Package to run.

Of course, if anyone wants me to compile a Multi-Threaded DLL build that requires the Runtime Package, let me know.

Link: https://dl.dropboxusercontent.com/u/24250760/SDL/SDL-2.0.3%20VS2015%20MT%20Build%20(x86).zip

I provided the “COPYING.txt” file found with the source code distribution to make sure original credit was given.

Addendum to my previous post: It currently uses the current stable build provided on the website. Not providing a SDL 2.0.4 build yet.

FYI, this particular bug, whereby there’s a build error in SDL_xinput.h, should now be fixed (in the latest code from https://hg.libsdl.org/SDL).

Are you still seeing the other build errors?

– David L.

rotanov wrote:> The first post errors occurred on Windows 7 system with Visual Studio 2015.

On another system (Windows 8 Visual Studio 2015) I got lots of those:

Severity Code Description Project File Line
Error C2011 ‘_XINPUT_BATTERY_INFORMATION’: ‘struct’ type redefinition [D:\dev\engine\build\sdl\src\sdl-build\SDL2.vcxproj] sdl d:\dev\engine\3rd\sdl\src\core\windows\SDL_xinput.h 122

Maybe related to this commit https://github.com/spurious/SDL-mirror/commit/bf785c766bdcdf6ad498123ae80d132a7192b10d

rotanov wrote:

The error with _XINPUT_BATTERY_INFORMATION is gone now. However I’m still experiencing previous build errors, listed below for debug and release builds respectively.

It kind-of looks like you might be mixing debug-mode and release-mode SDL dlls, but I could be wrong there.

Nope, I double checked this. 2013 is fine, 2015 results in errors. I’m using SDL as git submodule in my project therefore I’m not able to change its cmake makefiles. I’m including it in my cmake file with ExternalProject_Add. And I’m not sure if I can add required static libraries externally to SDL cmake project.

Sorry to hear that, and unfortunately I don’t think I can be of much help here. I am unfamiliar with SDL’s CMake setup, or CMake in general. I wouldn’t be surprised if there was either a bug in SDL’s CMake files, or perhaps CMake + VS2015, but am uncertain of this.

– David L.

I have now taken down the build I put up since 2.0.4 is now available and no longer requires anytime C Runtime Package.

I even tested it myself using the provided development libraries on the main website and found it to be the compatible with Multithreaded.

Yeah, there was a commit with fix to cmake files. I tested it a couple of days ago and it works for me just fine.