Linux 系统 配置vscode C++调试环境

隐藏文件 .vscode文件夹中,三个文件:

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "main",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/ws/tumian/bin/tumian",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "preLaunchTask": "build",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

 settings.json

{
    "files.associations": {
        "iostream": "cpp",
        "ostream": "cpp"
    }
}

tasks.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "build",
            "command": "/usr/bin/g++",
            "args": [ "--std=c++11","-g", "/home/ws/tumian/main.cpp","-o","/home/ws/tumian/bin/tumian",
                "-I","/usr/local/include",
                "-I","/usr/local/include/opnecv",
                "-I","/usr/local/include/opnecv2",
                "-L","/usr/local/lib",
                "-l","opencv_core",
                "-l","opencv_highgui",
                "-l","opencv_imgproc",
                "-l","opencv_imgcodecs",
                "-l","opencv_features2d"
                
            ],
            "options": {
                "cwd": "/usr/bin"
            }
        }
    ],
    "version": "2.0.0"
}

 

 

你可能感兴趣的:(程序员进阶,Linux,vscode,c++)