Skip to content

Commit

Permalink
VS 2015 compiling fixes
Browse files Browse the repository at this point in the history
note, wiki guide still doesn't work unless you also have vs2013 installed
  • Loading branch information
jacob1 committed Oct 14, 2016
1 parent 5370f07 commit 9e33906
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -46,6 +46,7 @@ Makefile.me
*.lastbuildstate
*.unsuccessfulbuild
*.pdb
*.db
*.sublime-*
*.project
*.cproject
Expand Down
13 changes: 1 addition & 12 deletions src/PowderToySDL.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions src/SDLCompat.cpp
@@ -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 changes: 17 additions & 0 deletions 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 <SDL/SDL_syswm.h>
#else
#include <SDL_syswm.h>
#endif
#endif

#endif //USE_SDL
6 changes: 1 addition & 5 deletions src/SDLMain.m
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions src/common/tpt-thread.h
Expand Up @@ -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

Expand Down
14 changes: 4 additions & 10 deletions src/gui/options/OptionsView.cpp
@@ -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"
Expand Down

0 comments on commit 9e33906

Please sign in to comment.