尝试使用全局设置在外部控制台上运行我的C程序,但遇到“找不到任务”,该怎么办?

问题描述

我正在学习C语言,最近我从Codeblocks转到VSCode。

为了每次通过在正确的位置设置中键入“ true”来编辑“ launch.json”以在外部控制台上运行时,我正在尝试通过使用setting.json将其设置为标准设置。

我已将launch.json粘贴在“ configurations []”内部,但是当我尝试运行时,出现错误“找不到任务'C / C ++:gcc.exe构建活动文件'”。 / p>

我该怎么解决这个问题?

我的task.json:

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

}

我粘贴到“ configurations”中的launch.json是启动的全局设置:

    {
        "name": "gcc.exe - Criar e depurar o arquivo ativo","type": "cppdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","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++: gcc.exe build active file"
    }

如果我使用worskpace launch.json,则C程序运行良好,因此在使用全局/用户设置时会出现问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...