1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Fix include order and defines for Windows builds

This commit is contained in:
Hielke Morsink
2018-06-18 18:46:49 +02:00
parent 79f1cf5a5c
commit ce59ed0ba2
7 changed files with 29 additions and 19 deletions

View File

@@ -7,15 +7,16 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
// Windows.h needs to be included first
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef CreateWindow
// Then the rest
#include <shellapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <shellapi.h>
#undef CreateWindow
#include <openrct2/audio/AudioContext.h>
#include <openrct2/Context.h>
#include <openrct2/OpenRCT2.h>

View File

@@ -15,7 +15,11 @@
#define _WIN32_WINNT 0x0600
#endif // __MINGW32__
#include <sstream>
// Windows.h needs to be included first
#include <windows.h>
#undef CreateWindow
// Then the rest
#include <openrct2/common.h>
#include <openrct2/core/Math.hpp>
#include <openrct2/core/Path.hpp>
@@ -23,8 +27,7 @@
#include <openrct2/ui/UiContext.h>
#include "UiContext.h"
#undef interface
#include <windows.h>
#include <sstream>
#include <shlobj.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>

View File

@@ -42,6 +42,8 @@
#endif
#include <SDL2/SDL_opengl.h>
// OpenRCT2: SDL_opengl.h includes windows.h, which defines the CreateWindow macro and causes conflicts
#undef CreateWindow
#ifdef OPENGL_NO_LINK

View File

@@ -7,25 +7,24 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <cassert>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include "../common.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "../Version.h"
#include "../common.h"
#include "Console.hpp"
#include "Diagnostics.hpp"
#include "Guard.hpp"
#include "String.hpp"
void openrct2_assert_fwd(bool expression, const char * message, ...)
#include <cassert>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
void openrct2_assert_fwd(bool expression, const char* message, ...)
{
va_list va;
va_start(va, message);

View File

@@ -9,8 +9,11 @@
#ifdef _WIN32
#include <memory>
// Windows.h needs to be included first
#include <windows.h>
// Then the rest
#include <memory>
#include <datetimeapi.h>
#include <shlobj.h>
#undef GetEnvironmentVariable

View File

@@ -13,12 +13,12 @@
#define _WIN32_WINNT 0x0600
#endif // __MINGW32__
#include "../common.h"
#ifdef _WIN32
#undef interface
// Windows.h needs to be included first
#include <windows.h>
// Then the rest
#include <lmcons.h>
#include <psapi.h>
#include <shlobj.h>

View File

@@ -131,6 +131,8 @@
#ifndef NOMINMAX
#define NOMINMAX
#endif
// OpenRCT2: Windows.h defines `interface` too without checking if it exists already, so we we have to undefine it first
#undef interface
#include <windows.h>
#include <io.h>
#ifndef STDIN_FILENO