如何使用 coc-clangd 在 vim 中使用 lib gtk 在 C 中编程?

how to program in C with lib gtk in vim with coc-clangd?

我复制了"Hello world" code from the website of the GTK project and pasted it into Vim with the environment to develop in C properly configured with coc-clangd。但是,

中显示了几个错误

#include <gtk/gtk.h>

但是当我用命令发送编译时:

gcc `pkg-config --cflags gtk+-3.0` -o hello-world-gtk hello-world-gtk.c `pkg-config --libs gtk+-3.0`

效果很好 我试着添加

`pkg-config --cflags gtk+-3.0`

clangd.fallbackFlags

:CocConfig 但没用。

https://clangd.llvm.org/troubleshooting.html

https://sarcasm.github.io/notes/dev/compilation-database.html

clang -MJ hello-world-gtk.o.json `pkg-config --cflags gtk+-3.0` -o hello-world-gtk hello-world-gtk.c `pkg-config --libs gtk+-3.0`

sed -e '1s/^/[\n/' -e '$s/,$/\n]/' *.o.json > compile_commands.json