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

1.2k views Asked by At

I copied the "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. However, several errors are shown in the

#include <gtk/gtk.h>

But when I send compile with the command:

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

it works perfectly I tried to add

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

in

clangd.fallbackFlags

in :CocConfig but it didn't work.

1

There are 1 answers

0
Lucas Martins Soares On BEST ANSWER

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