diff --git a/.gitignore b/.gitignore index 1e5c6598f..55f4c5301 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ Makefile.me *.lastbuildstate *.unsuccessfulbuild *.pdb +*.db *.sublime-* *.project *.cproject diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index e42af1441..22cde1dc5 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -3,15 +3,11 @@ #include #include #include -#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 #endif +#include "SDLCompat.h" #include #include #include @@ -54,13 +50,6 @@ extern "C" { using namespace std; -#if defined(WIN) || defined(LIN) -#ifdef SDL_INC -#include -#else -#include -#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; diff --git a/src/SDLCompat.cpp b/src/SDLCompat.cpp new file mode 100644 index 000000000..32c3f3adc --- /dev/null +++ b/src/SDLCompat.cpp @@ -0,0 +1,11 @@ +#if defined(USE_SDL) && defined(_MSC_VER) && (_MSC_VER >= 1900) + +#include + +FILE _iob[] = { *stdin, *stdout, *stderr }; +extern "C" FILE * __cdecl __iob_func(void) +{ + return _iob; +} + +#endif diff --git a/src/SDLCompat.h b/src/SDLCompat.h new file mode 100644 index 000000000..199285078 --- /dev/null +++ b/src/SDLCompat.h @@ -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 +#else +#include +#endif +#endif + +#endif //USE_SDL \ No newline at end of file diff --git a/src/SDLMain.m b/src/SDLMain.m index 511f7d287..b7f601f8b 100644 --- a/src/SDLMain.m +++ b/src/SDLMain.m @@ -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 /* for MAXPATHLEN */ #include diff --git a/src/common/tpt-thread.h b/src/common/tpt-thread.h index 0f0529a89..c36055085 100644 --- a/src/common/tpt-thread.h +++ b/src/common/tpt-thread.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 #undef GetUserName diff --git a/src/gui/options/OptionsView.cpp b/src/gui/options/OptionsView.cpp index 56d37b712..4d0fa3c2b 100644 --- a/src/gui/options/OptionsView.cpp +++ b/src/gui/options/OptionsView.cpp @@ -1,17 +1,11 @@ #include #ifdef WIN - #include - #define getcwd _getcwd +#include +#define getcwd _getcwd #else - #include -#endif -#ifdef USE_SDL -#ifdef SDL_INC -#include "SDL/SDL.h" -#else -#include "SDL.h" -#endif +#include #endif +#include "SDLCompat.h" #include "OptionsView.h" #include "Format.h"