c++ - 在 Visual Studio Code 中使用 C++ 进行调试时如何读取输入而不丢失编码?
问题描述
我想调试一个上面有 std::cin 的代码。
如果我把 launch.json '"externalConsole": false' 放在上面,我什么也写不出来(因为没有控制台可以处理它)。
但是,如果我输入“externalConsole”:true,我的 shell 参数将被忽略。
我只使用 IntelliSense。
启动.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - Criar e depurar o arquivo ativo",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Habilitar a reformatação automática para gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe arquivo de build ativo"
}
]
}
设置.json:
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.external.windowsExec": "C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k",
"chcp 65001"
],
"workbench.colorTheme": "Visual Studio Dark - C++",
}
我需要使用 '"terminal.integrated.shellArgs.windows": ["/k", "chcp 65001"]' 来使用我的编码系统。
有没有办法解决这个问题?
解决方案
推荐阅读
- autodesk-forge - 是否可以在 Forge 中获取 nwd 模型的已保存视图的名称?
- angular - 需要帮助使用此 API 来显示信息 (Ionic 3)
- r - 如何使用 mutate 函数用索引号替换唯一值?
- msbuild - 找不到 signtool 的临时位置。退出
- python - Pyspark - 使用广播字典中的日期过滤 RDD
- java - 动态 TextView 未在片段中更新
- azure - Azure 多个部署 409 冲突
- html - 当我保存时,内联 css 在文本编辑器中被删除。它创建了一个丑陋的 html 按钮,无处可去
- ios - 如何正确补偿CGContextRef坐标系,使原点在左上角
- chromecast - Chromecast Ultra 会限制 HTML 分辨率吗?