字节已用Unicode替换字符替换
尝试使用:
utf-8 编译
有三种办法, 你看看那种可以用就用那种.
1. CMake
CMakeLists.txt
里面加个add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
以utf-8编译
2. 项目属性
项目 > 属性 > c/c++ > 命令行 > 加上 \utf-8
3. 修改.json
在CMakeSettings.json
里面配置(x64-Debug的下拉菜单 > 管理配置 > 编辑json
)
"variables": [
{
"name": "CMAKE_CXX_FLAGS",
"value": "/source-charset:utf-8"
}
]
示例:
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_CXX_FLAGS",
"value": "/source-charset:utf-8"
}
]
}
]
}