VS 2015 compiling fixes

note, wiki guide still doesn't work unless you also have vs2013 installed
This commit is contained in:
jacob1 2016-10-13 22:32:52 -04:00
parent 5370f07bf0
commit 9e33906858
7 changed files with 40 additions and 27 deletions

1
.gitignore vendored
View File

@ -46,6 +46,7 @@ Makefile.me
*.lastbuildstate *.lastbuildstate
*.unsuccessfulbuild *.unsuccessfulbuild
*.pdb *.pdb
*.db
*.sublime-* *.sublime-*
*.project *.project
*.cproject *.cproject

View File

@ -3,15 +3,11 @@
#include <map> #include <map>
#include <string> #include <string>
#include <ctime> #include <ctime>
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#ifdef WIN #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 #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> #include <direct.h>
#endif #endif
#include "SDLCompat.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -54,13 +50,6 @@ extern "C" {
using namespace std; 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) #if defined(USE_SDL) && defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
SDL_SysWMinfo sdl_wminfo; SDL_SysWMinfo sdl_wminfo;
Atom XA_CLIPBOARD, XA_TARGETS, XA_UTF8_STRING; Atom XA_CLIPBOARD, XA_TARGETS, XA_UTF8_STRING;

11
src/SDLCompat.cpp Normal file
View File

@ -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

17
src/SDLCompat.h Normal file
View File

@ -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 File

@ -5,11 +5,7 @@
Feel free to customize this file to suit your needs Feel free to customize this file to suit your needs
*/ */
#ifdef SDL_INC #include "SDLCompat.h"
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#include "SDLMain.h" #include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */ #include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h> #include <unistd.h>

View File

@ -8,6 +8,11 @@
#define TH_ENTRY_POINT #define TH_ENTRY_POINT
#endif #endif
// fix 'timespec' error in VS 2015
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
#define _TIMESPEC_DEFINED 1
#endif
#include <pthread.h> #include <pthread.h>
#undef GetUserName #undef GetUserName

View File

@ -1,17 +1,11 @@
#include <cstdio> #include <cstdio>
#ifdef WIN #ifdef WIN
#include <direct.h> #include <direct.h>
#define getcwd _getcwd #define getcwd _getcwd
#else #else
#include <unistd.h> #include <unistd.h>
#endif
#ifdef USE_SDL
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#endif #endif
#include "SDLCompat.h"
#include "OptionsView.h" #include "OptionsView.h"
#include "Format.h" #include "Format.h"