工具/开发环境

VSCode调试C++

2018-09-17  本文已影响0人  cx7

调试配置

  1. 要调试的可执行程序编译生成时需要加入调试符号
    g++ test.cpp -g -o test.exe
  2. 配置VSCode
    在vscode项目的launch.json文件中配置要调试的可执行程序的路径和参数
{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/Users/cx/work/cx/webrtc/reposity/ZLMediaKit/ZLToolKit/build/bin/test_udpSock", //要调试的可执行程序的绝对路径
            "args": [], //传入的命令行参数
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ],
    "preLaunchTask":"test_udpSock"
}
上一篇 下一篇

猜你喜欢

热点阅读