2021-05-11我安装了并启用了插件 # C/C++ for Visual Studio Code
同时创建了
{
// 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": "${workspaceFolder}/hunt-skeleton",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
但是运行debug会报错
Unable to open 'futex-internal.h': Unable to read file '/build/glibc-eX1tMB/glibc-2.31/sysdeps/nptl/futex-internal.h' (Error: Unable to resolve non-existing file '/build/glibc-eX1tMB/glibc-2.31/sysdeps/nptl/futex-internal.h').
看起来是因为没有glibc库,然后我从https://sourceware.org/legacy-ml/libc-announce/2020/msg00001.html 下载,并且解压到/build/glibc-eX1tMB/
重新运行的话会提示#include错误
检测到 #include 错误。请更新 includePath。已为此翻译单元(/build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/clock_nanosleep.c)禁用波形曲线。
无法打开 源 文件 "kernel-features.h"
无法打开 源 文件 "sysdep-cancel.h"
无法打开 源 文件 "shlib-compat.h"