首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >运行c++程序时的VsCode

运行c++程序时的VsCode
EN

Stack Overflow用户
提问于 2018-08-13 14:03:27
回答 1查看 270关注 0票数 1

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

代码语言:javascript
运行
复制
{
"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文件:

代码语言:javascript
运行
复制
{
"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
            }
        }
    }
]}

他们以前是工作的,今天不是。当我运行任务终端时,显示如下:

而且它还在建设:

然后,当我调试(F5)程序时,它显示如下:

请告诉我如何运行c++程序。感谢您的回答!

EN

回答 1

Stack Overflow用户

发布于 2018-08-13 14:24:11

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

您只需更改label的值,使其与tasks.json中的任务名称相匹配

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51816022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档