LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   GTK 2.0 problem (https://www.linuxquestions.org/questions/linux-software-2/gtk-2-0-problem-386731/)

abhishekgedam 11-26-2005 01:03 PM

GTK 2.0 problem
 
hi
i have fedora core 4 on my system. i want to use gtk. 2.0 to compile following code
file name :- gtk1.c
#include <gtk/gtk.h>

int main (int argc , char *argv[])
{
GtkWidget *window
gtk_init (&argc , &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();

return 0;
}
i use following command for compilation
$ gcc gtk1.c -o gtk1 `pkg-config -cflags -libs gtk+-2.0`

i get the following error
cannot find gtk.h

can any body help

tomdkat 11-26-2005 01:19 PM

Try using this for the pkg-config part:

pkg-config --cflags --libs gtk+-2.0

Peace...

abhishekgedam 11-26-2005 01:23 PM

hi tomdkat
Thanks for the reply, but i am not getting u, so please can u elobrate.

tomdkat 11-26-2005 01:25 PM

Ok, in your post above change this:

$ gcc gtk1.c -o gtk1 `pkg-config -cflags -libs gtk+-2.0`

to this:
$ gcc gtk1.c -o gtk1 `pkg-config --cflags --libs gtk+-2.0`

You need two dashes before "clfags" and "libs" to get the output you desire. Consider this:

Code:

tom@linux:~$ pkg-config -cflags -libs gtk+-2.0 
-cflags: unknown option
tom@linux:~$ pkg-config --cflags --libs gtk+-2.0
-I/opt/gnome/include/gtk-2.0 -I/opt/gnome/lib/gtk-2.0/include -I/opt/gnome/include/atk-1.0 -I/opt/gnome/include/cairo -I/opt/gnome/include/pango-1.0 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include  -L/opt/gnome/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 
tom@linux:~$

Give that a try. :)

Peace...

abhishekgedam 11-26-2005 02:12 PM

hi tomdkat
IT WORKS
Thank you very much :)


All times are GMT -5. The time now is 05:41 AM.