How to use vscode to debug C program under mac

  1. Xcode and vscode have been installed on the computer
  2. vscode has also installed the following plug-ins

clipboard.png


clipboard.png
]

:

clipboard.png

< hr >

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "build hello world",
      "type": "shell",
      "command": "gPP",
      "args": [
        "-g",
        "main.cpp"
      ]
    }
  ]
}
< hr >

launch.json

{
  //  IntelliSense 
  // 
  // : https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(lldb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "enter program name, for example ${workspaceFolder}/a.out",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": true,
      "MIMode": "lldb"
    }
  ]
}
< hr >

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "cPP17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

ask what you need to do before you can write, debug and run C programs in vscode. Thank you ~

Jul.08,2021

"program": "${fileDirname} / ${fileBasenameNoExtension}",

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e510d9-45111.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e510d9-45111.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?