[newbie] 'undefined reference'-error when compiling a simple example



Hi,

i've installed the gtk 1.2 packet and would like to learn programming 
graphical interfaces. When I copy the first example from www.gtk.org and try 
to compile it (gcc), i get an 'undefined reference'-error at each external 
function.

source code:
#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);
}

gcc output:
/tmp/ccNg95OG.o: In function `main':
/tmp/ccNg95OG.o(.text+0x12): undefined reference to `gtk_init'
/tmp/ccNg95OG.o(.text+0x1f): undefined reference to `gtk_window_new'
/tmp/ccNg95OG.o(.text+0x33): undefined reference to `gtk_widget_show'
/tmp/ccNg95OG.o(.text+0x3b): undefined reference to `gtk_main'
collect2: ld returned 1 exit status

Thanks for all help
Karsten



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