From abfde4e77c1ae2cfd29c49583bb30f1f91e5693c Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 10 May 2017 05:47:42 +0800 Subject: [PATCH] fix MinGW's compiler errors --- include/nana/c++defines.hpp | 19 +++++++++++++------ source/paint/truetype.hpp | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 226a7d58..551b45bb 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -116,8 +116,6 @@ # define _enable_std_clamp # endif -#elif defined(NANA_MINGW) -# define STD_THREAD_NOT_SUPPORTED #elif defined(__clang__) //Clang #include //Introduces some implement-specific flags of ISO C++ Library @@ -132,9 +130,6 @@ #endif #endif - -# define _enable_std_clamp - #elif defined(__GNUC__) //GCC #include //Introduces some implement-specific flags of ISO C++ Library @@ -190,8 +185,20 @@ #endif #endif #endif +#endif -# define _enable_std_clamp +//Assume the std::thread is not implement on MinGW +//But some toolchains may implement std::thread. +#ifdef NANA_MINGW +# ifndef STD_THREAD_NOT_SUPPORTED +# define STD_THREAD_NOT_SUPPORTED +# endif +#endif + +#if (!defined(__cpp_lib_clamp)) || (__cpp_lib_clamp < 201603) +# ifndef _enable_std_clamp +# define _enable_std_clamp +# endif #endif diff --git a/source/paint/truetype.hpp b/source/paint/truetype.hpp index 2caa3f0e..bd44c0db 100644 --- a/source/paint/truetype.hpp +++ b/source/paint/truetype.hpp @@ -51,7 +51,7 @@ namespace nana truetype(const path_type& filename) { - std::ifstream ifs{ filename, std::ios::binary }; + std::ifstream ifs(filename.string(), std::ios::binary); if (!ifs.is_open()) return;