diff --git a/simgear/misc/strutils.cxx b/simgear/misc/strutils.cxx index 9fbcaf76..6865e6a8 100644 --- a/simgear/misc/strutils.cxx +++ b/simgear/misc/strutils.cxx @@ -26,7 +26,10 @@ #include #include // strerror_r() and strerror_s() #include -#include // new in C++11 + +#if defined(HAVE_CPP11_CODECVT) + #include // new in C++11 +#endif #include "strutils.hxx" @@ -401,9 +404,11 @@ std::wstring convertUtf8ToWString(const std::string& a) { #ifdef SG_WINDOWS return convertMultiByteToWString(CP_UTF8, a); -#else +#elif defined(HAVE_CPP11_CODECVT) std::wstring_convert, wchar_t> ucs2conv; return ucs2conv.from_bytes(a); +#else + return std::wstring(); #endif } @@ -411,9 +416,11 @@ std::string convertWStringToUtf8(const std::wstring& w) { #ifdef SG_WINDOWS return convertWStringToMultiByte(CP_UTF8, w); -#else +#elif defined(HAVE_CPP11_CODECVT) std::wstring_convert, wchar_t> ucs2conv; return ucs2conv.to_bytes(w); +#else + return std::string(); #endif }