From b12519be0a2abc24c2c03d7c012d895427709246 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sat, 27 Jun 2026 20:49:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(client/windows):=20runner=20=E5=8A=A0=20/ut?= =?UTF-8?q?f-8=20=E7=BC=96=E8=AF=91=E9=80=89=E9=A1=B9,=E6=A0=B9=E6=B2=BB?= =?UTF-8?q?=20C4819=20=E4=B8=AD=E6=96=87=E6=B3=A8=E9=87=8A=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit win32_window.cpp 含中文注释(UTF-8 无 BOM),在 zh-CN 机器(代码页 936)+ 新版 MSVC 上报 C4819「字符无法用当前代码页表示」,叠加 runner 的 /WX 直接 error C2220 编译失败。APPLY_STANDARD_SETTINGS 加 /utf-8,让 MSVC 按 UTF-8 解析 所有 runner 源码,永久根治。 Co-Authored-By: Claude Opus 4.8 --- client/windows/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/windows/CMakeLists.txt b/client/windows/CMakeLists.txt index 808d367..00ec32e 100644 --- a/client/windows/CMakeLists.txt +++ b/client/windows/CMakeLists.txt @@ -39,7 +39,9 @@ add_definitions(-DUNICODE -D_UNICODE) # of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + # /utf-8: 按 UTF-8 解析源码,否则 zh-CN 机器(代码页 936)对含中文注释的 runner + # 源码(如 win32_window.cpp)报 C4819,叠加 /WX 直接编译失败。 + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100" /utf-8) target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")