From cb3330d2ec893853f08f9d1b86aef2230eee5a62 Mon Sep 17 00:00:00 2001 From: zm1060 Date: Mon, 16 Oct 2023 22:34:31 +0800 Subject: [PATCH] Fix error: 'WC_ERR_INVALID_CHARS' was not declared in this scope --- src/sysinfo.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sysinfo.cc b/src/sysinfo.cc index bf7017c416..ae6dba90d7 100644 --- a/src/sysinfo.cc +++ b/src/sysinfo.cc @@ -15,6 +15,10 @@ #include "internal_macros.h" #ifdef BENCHMARK_OS_WINDOWS +#if !defined(WINVER) || WINVER < 0x0600 +#undef WINVER +#define WINVER 0x0600 +#endif // WINVER handling #include #undef StrCat // Don't let StrCat in string_util.h be renamed to lstrcatA #include @@ -428,9 +432,6 @@ std::string GetSystemName() { #ifndef UNICODE str = std::string(hostname, DWCOUNT); #else -#ifndef WC_ERR_INVALID_CHARS -#define WC_ERR_INVALID_CHARS 0x00000080 -#endif // `WideCharToMultiByte` returns `0` when conversion fails. int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, hostname, DWCOUNT, NULL, 0, NULL, NULL);