Re: [gtk-list] cannot compile using gtk



trout2 wrote:

> hello:
>
>  i have just installed gtk on my machine, and am trying to do the
> tutorials. i am unable to compile the simple tutorial programs. the
> following program:
>
> #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;
>  }
>
> returns these errors:
> /var/tmp/ccKQ22211.o: In function `main':
> /var/tmp/ccKQ22211.o(.text+0xf): undefined reference to `gtk_init'
> /var/tmp/ccKQ22211.o(.text+0x19): undefined reference to `gtk_window_new'
> /var/tmp/ccKQ22211.o(.text+0x2a): undefined reference to `gtk_widget_show'
> /var/tmp/ccKQ22211.o(.text+0x32): undefined reference to `gtk_main'
>
> i'm afraid i don't know enough about gtk to see whats going on here.
> i read through the first few pages of the tutorial, and it mentions the
> following gcc command:
>
> gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \ `gtk-config --libs`
>
> produces this error:
>
> gcc:  -L/usr/local/lib: No such file or directory
>
> what is "-L"?
> any suggestions would be appreciated
>

a man gcc or a man ld could tell you a lot.
-L gives a directory where to look at for libraries.
why did you put this \ ,
is it originally 2 lines ?
try with taking the \ off.

cheers

Ronan



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