我正在使用mac BigSur上的vscode学习C++。终端始终打印“终端将被任务重用,按任意键关闭它。”在尝试添加带有属性的“演示文稿”之后:“新建”。这个问题还在发生。
这是我的task.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "new"
},
"detail": "Generated task by Debugger"
}
],
"version": "2.0.0"}
这是我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: g++ build active file"
}
]}
发布于 2022-07-28 11:24:18
可以通过在“表示”块中添加属性"Terminal will be reused by tasks, press any key to close it."
来避免消息"showReuseMessage": false
。
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "new",
"showReuseMessage": false
},
但是,我们仍然需要按enter键才能返回命令提示符。为了避免按enter键,还应该在"presentation“块中添加另一个属性"close": true
。
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "new",
"showReuseMessage": false,
"close": true
},
我在上面的Visual代码版本1.68.0中测试了Windows 10,64位平台。
https://stackoverflow.com/questions/64995957
复制相似问题