1

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:

  1. Add include manually:

    (semantic-add-system-include "/usr/include/gtk-3.0/gtk")

  2. 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>

  3. Sym linking /usr/include/gtk to /usr/include/gtk-3.0/gtk

    cd /usr/include
    sudo ln -s gtk-3.0/gtk gtk

    This 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/)
  • Do you mean Emacs 24.4? Have you considered filing a bug? M-x report-emacs-bug. – PythonNut Apr 15 '15 at 21:16
  • I made typo. I have: 25.0.50.4 (quite recent...). I'm now pulling the cedet sources to see if it's fixed in recent versions. – Leo Ufimtsev Apr 15 '15 at 21:21
  • Just add (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. – Tu Do Apr 16 '15 at 3:03
  • @TuDo omg, your suggestion works perfectly. I spent 4 hours trying to figure it out and it was a little peculiar detail like that :-D. I'd happily accept is as an answer if you post it as one? – Leo Ufimtsev Apr 16 '15 at 13:48
1

Just add (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.

  • 1
    Thank you so much once again. This makes development muuuch easier. – Leo Ufimtsev Apr 16 '15 at 14:20
  • Glad you are enjoying Semantic :D – Tu Do Apr 16 '15 at 14:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.