vscode遠程調試C++需要做的配置工作

在.vscode中新增兩個配置文件

launch.json

{
    // 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": "SMA",
            "type": "cppdbg",
            "request": "launch",
            "program": 	"${workspaceFolder}/SMA/client/storesma",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ sma"
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type":  "shell",
            "label": "g++ sma",
            "command":  "g++",
            "args": [
                "-g",
                "-I",
                "/home/rtt/testSma/SMA/SMA/include",
                "-std=c++0x",
                "${workspaceFolder}/client/storeDataToRedis/storeDataToRedis.cpp",
                "-L",
                "../lib_x64",
                "-l",
                "crypto",
                "-l",
                "curl",
                "-l",
                "zmq",
                "-l",
                "log4cplus",
                "-l",
                "boost_filesystem",
                "-l",
                "boost_system",
                "-l",
                "boost_thread",
                "-l",
                "cpprest",
                "-l",
                "cpp_redis",
                "-l",
                "tacopie",
                "-l",
                "pthread",
                "-o",
                "${workspaceFolder}/SMA/client/storesma"
           ],
            "options": {
                "cwd":  "${workspaceFolder}"
           }
       }
    ]
}

配置文件中的路徑目前是必須填寫絕對路徑,相對路徑是不起作用的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章