• Advertisement
Sign in to follow this  

GTK2+ on Ubuntu

This topic is 4724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using Anjuta as a IDE, and when I try to include the gtk/gtk.h file it gives me alot of error that he cant find the include files. now I tried to copy all the directories from /usr/include/gtk-2.0 to /usr/include/ but it only game me alot of other diffrent errors... anyone is using GTK on ubuntu? please?

Share this post


Link to post
Share on other sites
Advertisement
gcc doesn't look into /usr/include/gtk-2.0 for header files by default, so you have to tell gcc where to find the headers. You can do this by adding -I/usr/include/gtk-2.0 to the compiler flags


Share this post


Link to post
Share on other sites
I think you should use pkg-config.

Add this to the compiler flags:
`pkg-config --cflags gtk+-2.0`
to get the includes and this to the linker flags:
`pkg-config --libs gtk+-2.0`
to get the flags to link to gtk2.

If there is only one place to put both of these, you can use
`pkg-config --cflags --libs gtk+-2.0`

Note that the backticks (``) are not apostrophes ('').

You should also read man pkg-config and run echo `pkg-config --cflags --libs gtk+-2.0` to see and understand how it works and why it is so useful.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement