Permalink
Browse files

VS 2015 compiling fixes

note, wiki guide still doesn't work unless you also have vs2013 installed
  • Loading branch information...
1 parent 5370f07 commit 9e33906858e4d078de425abb19c46ecb9e82c210 @jacob1 jacob1 committed Oct 14, 2016
Showing with 40 additions and 27 deletions.
  1. +1 −0 .gitignore
  2. +1 −12 src/PowderToySDL.cpp
  3. +11 −0 src/SDLCompat.cpp
  4. +17 −0 src/SDLCompat.h
  5. +1 −5 src/SDLMain.m
  6. +5 −0 src/common/tpt-thread.h
  7. +4 −10 src/gui/options/OptionsView.cpp
View
@@ -46,6 +46,7 @@ Makefile.me
*.lastbuildstate
*.unsuccessfulbuild
*.pdb
+*.db
*.sublime-*
*.project
*.cproject
View
@@ -3,15 +3,11 @@
#include <map>
#include <string>
#include <ctime>
-#ifdef SDL_INC
-#include "SDL/SDL.h"
-#else
-#include "SDL.h"
-#endif
#ifdef WIN
#define _WIN32_WINNT 0x0501 //Necessary for some macros and functions, tells windows.h to include functions only available in Windows XP or later
#include <direct.h>
#endif
+#include "SDLCompat.h"
#include <iostream>
#include <sstream>
#include <string>
@@ -54,13 +50,6 @@ extern "C" {
using namespace std;
-#if defined(WIN) || defined(LIN)
-#ifdef SDL_INC
-#include <SDL/SDL_syswm.h>
-#else
-#include <SDL_syswm.h>
-#endif
-#endif
#if defined(USE_SDL) && defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
SDL_SysWMinfo sdl_wminfo;
Atom XA_CLIPBOARD, XA_TARGETS, XA_UTF8_STRING;
View
@@ -0,0 +1,11 @@
+#if defined(USE_SDL) && defined(_MSC_VER) && (_MSC_VER >= 1900)
+
+#include <cstdio>
+
+FILE _iob[] = { *stdin, *stdout, *stderr };
+extern "C" FILE * __cdecl __iob_func(void)
+{
+ return _iob;
+}
+
+#endif
View
@@ -0,0 +1,17 @@
+#ifdef USE_SDL
+
+#ifdef SDL_INC
+#include "SDL/SDL.h"
+#else
+#include "SDL.h"
+#endif
+
+#if defined(WIN) || defined(LIN)
+#ifdef SDL_INC
+#include <SDL/SDL_syswm.h>
+#else
+#include <SDL_syswm.h>
+#endif
+#endif
+
+#endif //USE_SDL
View
@@ -5,11 +5,7 @@
Feel free to customize this file to suit your needs
*/
-#ifdef SDL_INC
-#include "SDL/SDL.h"
-#else
-#include "SDL.h"
-#endif
+#include "SDLCompat.h"
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
@@ -8,6 +8,11 @@
#define TH_ENTRY_POINT
#endif
+// fix 'timespec' error in VS 2015
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+#define _TIMESPEC_DEFINED 1
+#endif
+
#include <pthread.h>
#undef GetUserName
@@ -1,17 +1,11 @@
#include <cstdio>
#ifdef WIN
- #include <direct.h>
- #define getcwd _getcwd
+#include <direct.h>
+#define getcwd _getcwd
#else
- #include <unistd.h>
-#endif
-#ifdef USE_SDL
-#ifdef SDL_INC
-#include "SDL/SDL.h"
-#else
-#include "SDL.h"
-#endif
+#include <unistd.h>
#endif
+#include "SDLCompat.h"
#include "OptionsView.h"
#include "Format.h"

0 comments on commit 9e33906

Please sign in to comment.