Re: Problems compiling hello.c :P



Yes, i'm having problems... i use Debian 3.0 SID with all GTK+ 2.0 packages (dev/bin of 
gtk+,glib,atk,pango...) and when I try to compile
the code i have the message "hello.v:1: gtk/gtk.h: No such file or directory".

i compile with this command:
morti portatil:~/Devel/gtk$ gcc hello.c -o hello `pkg-config --cflags --libs gtk+-2.0`

To understand what is wrong, do this:
1) go to your home directory (for example)

and type: pkg-config --cflags<Return>

You should see a list of -I/path directories 
where are the gtk/glib headers, gtk/gtk.h in particular,
I suspect there's something wrong with the address for
your gtk headers, the right address for gtk headers should
be the directory:

your_path/include/gtk-2.0

When you are inside this directory, if you type ls
you should see this:

gdk/  gdk-pixbuf/  gdk-pixbuf-xlib/  gtk/

that's because the headers are defined as:

#include <gtk/gtk.h>

so you must point to the directory where is the gtk directory
which in turn contain the gtk.h header

many libraries include the file without previous
directories, for example:

#include <expat.h>

in this case the -I/path should point directly 
to the exact directory where is expat.h

The bad news are:
Unfortunately pkg-config is not a script
but a binary which you can not change easily,
at least to the best of my knowledge,
you probably would have to reinstall gtk 
again to get the right paths

The good news are:
As long as all your gtk libraries are
properly installed, you don't need pkg-config
for nothing. Just forget it exists and 
write the correct -I, -L and -l statements
directly in your makefiles or in a simple
script file

Anyway I find it quite strange that
your examples are not already compiled,
when you compile gtk from source, in the
end you get the libraries and the examples,
all compiled and working properly

Carlos



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]