VSCode——ubuntu平台配置C运行环境

前言:具体配置步骤可以参考我上一篇——windows平台配置C运行环境,大致是一样的(gdb安装不一样),在此就不再过多描述,主要参考两个json文件

launch.json

可以直接 ctrl^c + ctrl^v 使用

{
    
    
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
    
    
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "preLaunchTask": "build",
            "miDebuggerArgs": "-q -ex quit; wait() { fg >/dev/null; }; /bin/gdb -q --interpreter=mi",
            "setupCommands": [
                {
    
    
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

tasks.json

可以直接 ctrl^c + ctrl^v 使用

{
    
    
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
    
    
            "label": "build",
            "type": "shell",
            "command": "gcc",
            "args": [
                "-g",
                "-o",
                "${fileBasenameNoExtension}",
                "${file}"
            ]
        }
    ]
}

猜你喜欢

转载自blog.csdn.net/WU2629409421perfect/article/details/113359235
今日推荐