DragonFly users List (threaded) for 2008-10
Re: problem in gtk programming
I installed pkg-config, xproto, renderproto and kbproto packages
because they required.
Now if I type:
#gcc 'pkg-config gtk+-2.0 --libs --cflags' prova.c -o prova
gcc: pkg-config gtk+-2.0 --libs --cflags: No such file or directory
If I type:
#gcc '/usr/pkg/bin/pkg-config gtk+-2.0 --libs --cflags' prova.c -o prova
gcc: /usr/pkg/bin/pkg-config gtk+-2.0 --libs --cflags: No such file or directory
How can I include pkg-config in gcc command?
2008/10/19, walt <firstname.lastname@example.org>:
> dark0s Optik wrote:
>> I am triyng to programming with gtk over DragonFly.
>> My sample code is the follows:
>> The gcc output is:
>> #gcc prova.c -o prova
> > ...
> Hi Savio,
> The gtk header files are in /usr/pkg/include because you are
> using the gtk package from pkgsrc (like most of us). That's
> fine if you are building another pkgsrc package because all
> pkgsrc packages are smart enough to look in /usr/pkg/include
> for the required header files.
> But, if you are writing your own code you need to tell gcc
> where to look for the gtk headers, because gcc is only smart
> enough to look in /usr/include -- it knows nothing about the
> /usr/pkg/include directory unless you tell it.
> So you need to do something like this:
> #gcc -I/usr/pkg -I/usr/pkg/include prova.c -o prova
> But wait, now the loader doesn't know where to look for the
> gtk libraries, so you will get a different error about that.
> The gnu autotools people devised the pkg-config system to
> solve this very common problem. Try this:
> #pkg-config --list-all | grep gtk (look for gtk+-2.0)
> #pkg-config --cflags --libs 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/freetype2
> -I/usr/include/libpng12 -I/usr/include/pixman-1 -lgtk-x11-2.0
> -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0
> -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
> That horrible list of flags is what you need to give gcc to compile
> *and* link your program against gtk -- but I'm doing this on a linux
> machine and you should see different flags on your dragonfly machine.
> I leave the rest as an exercise for the reader ;o)
only the paranoid will survive