【问题标题】:how to program in C with lib gtk in vim with coc-clangd?如何使用 coc-clangd 在 vi​​m 中使用 lib gtk 在 C 中编程?
【发布时间】:2020-10-11 02:09:15
【问题描述】:

我复制了 "Hello world" code from the website of the GTK project 并将其粘贴到 Vim 中,并使用正确配置了 coc-clangd 的 C 开发环境。但是,在

中显示了几个错误

#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 中,但它不起作用。

【问题讨论】:

    标签: vim clang clang++ coc.nvim clangd


    【解决方案1】:

    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-23
      • 1970-01-01
      • 1970-01-01
      • 2014-10-09
      • 2011-06-14
      • 1970-01-01
      相关资源
      最近更新 更多