#pkg-config --libs --cflags gtk+-2.0 -I/usr/pkg/include/gtk-2.0 -I/usr/pkg/lib/gtk-2.0/include -I/usr/pkg/include/atk-1.0 -I/usr/pkg/include/cairo -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include -I/usr/pkg/include/libpng12 -I/usr/pkg/include/pixman-1 -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -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 -lglib-2.0 -lintl
I must include all above librarries and path in gcc command, how can I run gcc with pkg-config as gcc 'pkg-config gtk+-2.0 --libs --cflags .... 2008/10/26, dark0s Optik <[EMAIL PROTECTED]>: > 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? > > Regards, > savio > > 2008/10/19, walt <[EMAIL PROTECTED]>: >> dark0s Optik wrote: >>> I am triyng to programming with gtk over DragonFly. >>> My sample code is the follows: >>> >>> #include<gtk/gtk.h> >>> ... >>> >>> 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 > -- only the paranoid will survive
