I am now using vi to edit a Gtk program in C. I can compile it easily using the command:

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

There is no problem doing this. But when I am editing it in vi, there are lots of errors (I am using ycmd for auto-completion):


and the first error being <gtk/gtk.h> not found. If I change it to <gtk-3.0/gtk/gtk.h> it will work, but it has problem in the header gtk.h itself, like it can't find <gdk/gdk.h>. Can anyone tell me how to solve this? Thanks.

EDIT: I use the following flags in the .ycm_extra_conf.py:


But in the end it also has these errors:


  • What does your .ycm_extra_conf.py look like? – muru Mar 20 '16 at 8:23
  • There is no such file. But I do find one in the example folder of the ycm module. Do you mean that I should use that example, place in my working directory and use it as config for ycmd? – Chromium Mar 20 '16 at 9:00
  • 1
    You should read YCM's documentation. – romainl Mar 20 '16 at 10:32
  • Maybe yes. I copied the conf into my cwd and it worked. But there are other errors. – Chromium Mar 20 '16 at 12:48
  • 1
    pkg-config --cflags gtk+-3.0 outputs a lot more than what you have included here. – muru Mar 20 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.