Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just started GTK+ coding in C. I was curious whether i can get syntax highlight and auto-completion working for my GTK code... because as a beginner it would be helpful.

I was completely convinced that it was not possible until i came across this video on youtube: I asked the uploader for help, but turns out his last activity on youtube was in Septembeer :(

I also tried opening the gtk.h file with geany as i had read somewhere that it worked, but unfortunately it didn't work too.

Any help? :'(

share|improve this question
Is this what you meant by opening gtk.h? – Louis Nov 1 '12 at 16:54 thought opening means just browse the file and open it? isn't it like that? if not please enlighten me... i'm new to gtk+. – Prasanna Choudhari Nov 1 '12 at 17:00
almost, but you have do do a couple of things first. See my answer. – Louis Nov 2 '12 at 0:35
up vote 1 down vote accepted

First create a file called gtk_headers.c. Add this line and save it #include <gtk/gtk.h>

Now run one of the following based on which version of GTK+ you are using.


gcc -E gtk_headers.c `pkg-config gtk+-2.0 --cflags --libs` -o


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

Finally, open the output file (gtk_headers.h) in Geany while your project is open. After a few seconds syntax highlighting and autocompletion will begin to work.

share|improve this answer
Thanks @Louis! That Worked.... I also found an alternative method which is generating gtk3.c.tags file through geany...and then load that it learns the synatxes.. Thanks a lot! Btw, your method can be easily incorporated in a im going with it.. – Prasanna Choudhari Nov 2 '12 at 8:08

Download this package and extract it to ~/.config/geany/tags.

Restart Geany and you're done!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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