-
两种方式提供信息
-
compile_commands.json
[juhan@arch linux-6.16-rc3]$ pwd /home/juhan/local/riscv-linux/linux-6.16-rc3 [juhan@arch linux-6.16-rc3]$ ./scripts/clang-tools/gen_compile_commands.py -
compile_flags.txt
-
-
Linux 也不用系统头文件,不用去管相应设置
Clangd will use the compile flags from the compile_commands.json, and its own built-in includes.
-
compiler option warning
在源代码根目录新建一个
.clangd,里面内容是:CompileFlags: Remove: [-mno-riscv-attribute, -fno-allow-store-data-races,-fmin-function-alignment=4, -fconserve-stack]
https://www.reddit.com/r/neovim/comments/xvl903/lsp_clangd_question_how_to_use_custom_compiler/
--query-driver option on itself just specifies an allowed list of drivers to execute. The real driver paths are deduced from compile commands.
-
系统头文件
如果用的不是编译器不是 clang,比如 gcc,需要进行设置,来寻找 gcc 的系统头文件。
先设置
--query-driver=,然后compile_commands.json里的编译器要要匹配--query-driver=。