compling gtk app problem
Can anyone help? This seems to be simple, but I don't know how to get it work. I am trying to compile a simple gtk app. I installed the gtk package, but still did not fix.
#include <gtk/gtk.h> int main() { ... } Here is how i compile the code, $ gcc ghelloworld.c -o ghello 'pkg-config --cflags --libs gtk+-2.0' gcc: pkg-config --cflags --libs gtk+-2.0: No such file or directory ghelloworld.c:1:21: gtk/gtk.h: No such file or directory ghelloworld.c: In function `main': ghelloworld.c:6: error: `GtkWidget' undeclared (first use in this function) The path looks correct..as i checked with following cmd, $ echo $PKG_CONFIG_PATH /usr/lib/pkgconfig/ $ pwd /usr/include/gtk-2.0/gtk $ ls gtk+* gtk+-2.0.pc gtk+-x11-2.0.pc The header file gtk.h is also at where it should be <gtk/gtk.h> $ pwd /usr/include/gtk-2.0/gtk $ ls -l gtk.h -rw-r--r-- 1 root root 5675 Sep 30 2005 gtk.h I also check to make sure that the pkg-config work, $ pkg-config --cflags --libs gtk+-2.0 -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 |
You need to use backticks instead of single quotes around the command:
gcc ghelloworld.c -o ghello `pkg-config --cflags --libs gtk+-2.0` |
that works. Thanks.. :)
|
All times are GMT -5. The time now is 03:13 AM. |