[求助] Windows vscode Cmake 编译时插件输出乱码

查看 11|回复 1
作者:proxytoworld   
我家里的电脑使用 cmake 编译 dll 时输出乱码如下
[main] 正在生成文件夹: c/build testdll
[build] 正在启动生成
[proc] 执行命令: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build c/build --config Release --target testdll -j 26 --
[build] 閫傜敤浜� .NET Framework MSBuild 鐗堟湰 17.11.9+a69bbaaf5
[build]
[build]   testdll.vcxproj -> \c\build\Release\testdll.dll
[driver] 生成完毕: 00:00:00.365
[build] 生成已完成,退出代码为 0
已在C:\Users\username\Documents\PowerShell\Microsoft.PowerShell_profile.ps1添加了 chcp 切换编码
chcp 65001 | Out-Null
已在 vscode settings.json 添加启动命令,并且有效
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell",
            "args": [
                "-NoExit",
                "/c",
                "chcp 65001",
            ],
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        }
    },
   
Active code page: 65001
\c :: git(master)                                                                                                                                                                                                                                                                                                                              00:07:35  
➜ chcp
活动代码页: 65001
但我另外一台电脑是正常的,
[main] 正在生成文件夹: c/build hello
[build] 正在启动生成
[proc] 执行命令: "\cmake.exe" --build c/build --config Debug --target hello -j 22 --
[build] 适用于 .NET Framework MSBuild 版本 17.9.8+b34f75857
[build]
[build]   1>Checking Build System
[build]   Building Custom Rule c/CMakeLists.txt
[build]   helloworld.c
[build]   hello.vcxproj -> c\build\Debug\hello.exe
[driver] 生成完毕: 00:00:02.853
[build] 生成已完成,退出代码为 0
proxytoworld
OP
  
已解决:运行 intl.cpl-》管理-》更改系统区域设置,启用 65001 支持就行了
您需要登录后才可以回帖 登录 | 立即注册

返回顶部