This works:
Running semantic-decoration-include-visit (opens the included header):
#include <string.h>
#include "/usr/include/gtk-3.0/gtk/gtk.h"
Works well.
This does not:
But if I run it on a relative gtk path:
#include <gtk/gtk.h>
Then I get an error:
semantic-decoration-include-visit: Could not location include gtk/gtk.h
Troubleshooting attempts:
Add include manually:
(semantic-add-system-include "/usr/include/gtk-3.0/gtk")My own .h file:
If I create a 'hello.h' inside /usr/include, and add the following to some C file, then semantic include visit works on that also:#include <hello.c>Sym linking
/usr/include/gtkto/usr/include/gtk-3.0/gtkcd /usr/include
sudo ln -s gtk-3.0/gtk gtkThis actually gets the desired result. (but this has issues as I do Gtk2/Gtk3 development and I'd have to re-link many many many times...
My question being, why doesn't (semantic-add-system-include "/usr/include/gtk-3.0/gtk") make it so that is properly located?
Please note
- I'm an intern, learning about C development. I might be missing something obvious.
- I'm setting up Emacs for C-Development as per this guide
- I'm on Emacs 25.0.50.4, using build-in CEDET (although tried with latest CEDET, had same error)
- I compile the gtk using pkg-config which appends some flags:
gcc `pkg-config --cflags gtk+-3.0` -o main main.c `pkg-config --libs gtk+-3.0`
SOLUTION
As per comment below, It turns out this is wrong:
(semantic-add-system-include "/usr/include/gtk-3.0/gtk")
This is Correct (minus 'gtk' at end), to match the pattern:
(semantic-add-system-include "/usr/include/gtk-3.0/)
M-x report-emacs-bug.(semantic-add-system-include "/usr/include/gtk-3.0/"). It is because you use include your header as#include <gtk/gtk.h>, so the file you included will be found when the two paths are combined. It is the same thing for other packages or editors out there. For example, see this reddit question which is similar issue to yours.