


























直接通过生成clang索引,提供给VSCODE CPPTOOLS插件使用,避免多装一个CLAND插件造成冲突
# 编译一次后
# 在kernel-6.10目录下
scripts/clang-tools/gen_compile_commands.py
CTRL+SHIFT+P => C/C++: Edit configurations (UI) => Advanced Settings => Compile commands
添加一行
${workspaceFolder}/compile_commands.json

配置后的 .vscode/c_cpp_properties.json 大概如此:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"compileCommands": [
"${workspaceFolder}/compile_commands.json"
]
}
],
"version": 4
}
然后重启,等待索引完成即可。
另外非内核普通程序也可以通过 cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=True .. 生成CLAND索引 https://www.cnblogs.com/cong-wang/p/15026530.html
双语:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。