c - Header files in subdirectories (e.g. gtk/gtk.h vs gtk-2.0/gtk/gtk.h) -


I am trying to create a Hello world using GTK, which includes the line:

< Pre> #include> Gtk / gtk.h>

As you would expect.

The makeup line supply line is:

  GTK_INCLUDE = -i / usr / local / include  

so it is gtk.h To find /usr/local/include/gtk/gtk.h. However on my system, it is located in /usr/local/include/gtk-2.0/gtk/gtk.h, that is, within the version's subdirectory.

Obviously, in this case I can add- I / Usr / local / include / gtk-2.0 in the makefile, but the same problem is cropped with dependence of gtk.h and so on.

Is there a good way to deal with this? Can be configured to find out where the header files are and add appropriate directories? I do not know anything about configurations, but information about the system is found on time, which is what I am after.

Is this a common occurrence or do I have some strange directory structure? Is that a real problem?

Thanks for any indication!

You need to use the path to include the pkg-config :

  $ pkg-config --cflags gtk + -2.0 -i / usr / include / gtk-2.0 -i / usr /lib/gtk-2.0/include -i / usr / Include / atk-1.0 -i / usr / include / cairo-I / usr / include / pango-1.0 -i / usr / include / glib-2.0 -i / usr /lib/glib-2.0/include -i / usr / Include / pixman-1-I / usr / include / freetype2 -i / usr / include / libpng12  

You should also use it to get the library:

  $ pkg-config -libs gtk + -2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 - Lm-lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  

(The output of these commands will be different depending on your distribution, and your distribution will always be correct.)


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -