内部调试控制台不接受我的输入



当我在内部调试控制台(例如数字)中输入输入时,我会收到消息"由于进程正在运行,无法执行此操作"(输出没有问题),但当我在launch.json中切换外部控制台(Windows控制台)时,我没有遇到任何问题。

我读过一些关于VSC调试的纪录片(例如code.visionstudio.com/Docs/editor/debug),但没有任何内容。我不应该在那里输入吗?另外,我的输出只显示在调试控制台中,这也正常吗?我也无法通过终端输入我的输入。即使我在没有调试的情况下启动,情况也不会改变。如果我使用扩展"C/C++编译-运行",那么就会创建正常的内部终端,我可以与它交互

我的launch.json配置

"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"internalConsoleOptions": "openOnSessionStart",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\MinGW\bin\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++.exe build active file"

我的任务.json:

"type": "shell",
"label": "g++.exe build active file",
"command": "C:\MinGW\bin\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\MinGW\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}

c_cpp_properties.json:

"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"

据我所知,调试控制台不支持在c++程序中从控制台读取输入。唯一可能的解决方案是通过将true设置为externalConsole属性来使用外部终端。

官方文件称将console属性配置为integratedTerminal用于Node.js编程。但是对于c++程序没有这样的规定。

围棋编程也有类似的悬而未决的问题。可能是vscode团队会在他们的积压工作中有这个。

最新更新