gpt4 book ai didi

c++ - 运行 C++ 程序时的 VsCode

转载 作者:太空宇宙 更新时间:2023-11-04 12:45:33 24 4
gpt4 key购买 nike

这是我的 VsCode 的 launch.json 文件:

{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceRoot}\\${fileBasename}.exe",
"miDebuggerPath":"C:\\mingw-w64\\bin\\gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "g++"  
}
]

}这是我的 tasks.json 文件:

{
"version": "2.0.0",
"tasks": [
{
"label": "<TASK_NAME>",
"type": "shell",
"command": "make",
// use options.cwd property if the Makefile is not in the project root ${workspaceRoot} dir
"options": {
"cwd": "${workspaceRoot}/<DIR_WITH_MAKEFILE>"
},
// start the build without prompting for task selection, use "group": "build" otherwise
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
// arg passing example: in this case is executed make QUIET=0
"args": ["QUIET=0"],
// Use the standard less compilation problem matcher.
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["absolute"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]}

他们以前工作过,今天没有。当我运行任务终端时显示: 它也在 build 中: 然后当我调试(F5)程序时它显示了这个:

请帮助我如何运行 C++ 程序。谢谢解答!

最佳答案

您已经配置了一个名为 g++ 的预启动任务,但没有该名称的任务。您需要将构建任务的名称更改为 g++。

你只需要改变 label 的值来匹配来自 tasks.json 的任务名称

关于c++ - 运行 C++ 程序时的 VsCode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51816022/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com