Commit ac444cd31375e566449e3780024dddd63e03e23a

Sam Lantinga 2016-01-02T10:25:53

Fixed bug 3092 - Statically link sdl2 with /MT for msvc Martin Gerhardy According to https://msdn.microsoft.com/de-de/library/2kzt1wy3%28v=vs.120%29.aspx when one is using /MT for msvc compilations the libcmt.lib is already linked to the binary. This lib includes the symbol that is now guarded (see attached patch) by the #ifndef _MT.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c
index f11f65d..85872e2 100644
--- a/src/stdlib/SDL_stdlib.c
+++ b/src/stdlib/SDL_stdlib.c
@@ -275,8 +275,11 @@ int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) :
 
 #ifndef __FLTUSED__
 #define __FLTUSED__
+/* the multithreaded runtime already includes libcmt.lib - and this symbol is in there. */
+#ifndef _MT
 __declspec(selectany) int _fltused = 1;
 #endif
+#endif
 
 /* The optimizer on Visual Studio 2005 and later generates memcpy() calls */
 #if (_MSC_VER >= 1400) && defined(_WIN64) && !defined(_DEBUG)