共计 1225 个字符,预计需要花费 4 分钟才能阅读完成。
我家里的电脑使用 cmake 编译 dll 时输出乱码如下
[main] 正在生成文件夹: c/build testdll
[build] 正在启动生成
[proc] 执行命令: "C:Program FilesMicrosoft Visual Studio2022CommunityCommon7IDECommonExtensionsMicrosoftCMakeCMakebincmake.exe" --build c/build --config Release --target testdll -j 26 --
[build] 閫傜敤浜� .NET Framework MSBuild 鐗堟湰 17.11.9+a69bbaaf5
[build]
[build] testdll.vcxproj -> cbuildReleasetestdll.dll
[driver] 生成完毕: 00:00:00.365
[build] 生成已完成,退出代码为 0
已在 C:UsersusernameDocumentsPowerShellMicrosoft.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 -> cbuildDebughello.exe
[driver] 生成完毕: 00:00:02.853
[build] 生成已完成,退出代码为 0
正文完