Re: gtk application compile error



Obviously the compiler is having problems finding your development libraries. There may well be something wrong with your devel package, but you should be able to work round it. Run "gtk-config --cflags" and it should give a list of directories preceeded by a "-I" look in each of these and check that they first exist and that secondly one of them includes a folder "gtk" with a file "gtk.h" in it. The error is not due to you missing the include in your source, but because the compiler cannot find the required header. If you manage to find the header you can always add it manually to the arguments to the compiler with "-I/path/to/header" remember that the header must then be at "/path/to/header/gtk/gtk.h" hope this is of some help.
Jon Wilson

Raheel wrote:

hi ......... I have written a very basic program using gtk_widgets. And tried the command line switches. Below is what i got when try to compile: # gcc -Wall wind.c -o wind.o 'gtk-config --libs --cflags' > gcc: gtk-config --libs --cflags: No such file or directory
> wind.c:2:21: gtk/gtk.h: No such file or directory
> wind.c: In function `main':
> wind.c:7: `GtkWidget' undeclared (first use in this function)
> wind.c:7: (Each undeclared identifier is reported only once
> wind.c:7: for each function it appears in.)
> wind.c:7: `window' undeclared (first use in this function)
> wind.c:9: warning: implicit declaration of function `gtk_init'
> wind.c:11: warning: implicit declaration of function `gtk_window_new'
> wind.c:11: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)
> wind.c:12: warning: implicit declaration of function `gtk_widget_show'
> wind.c:14: warning: implicit declaration of function `gtk_main'
>
> plz help me, I am hanging between all this.
>
> Raheel.
plz note my source code is:
# 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 (); //printf ("this is first gcc program\n");
  //printf ("%s", argv[1]);
  //printf ("%s", argv[2]);
return 0;
}
AND my development box is solaris 8.0 (sparc).






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