From 7d9a0bda3ab8f92243c970cc130a07b39d374364 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Tue, 19 Feb 2019 16:03:23 +0900 Subject: [PATCH] Define NOMINMAX to avoid defining MIN/MAX macros on Windows. Without defining NOMINMAX, MIN/MAX macro would affect other header/c++ files. Fixes #143 --- tiny_gltf.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index ee596e9..81458a6 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -1086,7 +1086,21 @@ class TinyGLTF { #endif #ifdef _WIN32 -#include + +// issue 143. +// Define NOMINMAX to avoid min/max defines, +// but undef it after included windows.h +#ifndef NOMINMAX +#define TINYGLTF_INTERNAL_NOMINMAX +#define NOMINMAX +#endif + +#include // include API for expanding a file path + +#if defined(TINYGLTF_INTERNAL_NOMINMAX) +#undef NOMINMAX +#endif + #elif !defined(__ANDROID__) #include #endif