Undefined reference to ... Using gtk graphics

Viewed 4604

I am trying to implementing graphics on a c-program I have recently made. My teacher suggested this link:

https://developer.gnome.org/gtk-tutorial/2.22/c39.html

And I have installed the gtk-package and in Eclipse - I have included the relevant paths and at first glimpse everthing seems fine before compiling.

 #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;
}

This small example macro from the tutorial is supposed to show a window of 200x200 px. But when compiling I get the following errors:

 C:\Documents and Settings\Ägaren\workspace\cGraphics1\Debug/../src/cGraphics1.c:19:  undefined reference to `gtk_init_abi_check'
 C:\Documents and Settings\Ägaren\workspace\cGraphics1\Debug/../src/cGraphics1.c:21: undefined reference to `gtk_window_new'
 C:\Documents and Settings\Ägaren\workspace\cGraphics1\Debug/../src/cGraphics1.c:22: undefined reference to `gtk_widget_show'
 C:\Documents and Settings\Ägaren\workspace\cGraphics1\Debug/../src/cGraphics1.c:24: undefined reference to `gtk_main'

So the question is why I get these errors? Could the answer be that I should user more includes of header-files? I have only one include as you can see. Or could it be so that I need to link several object-files when compiling? In eclipse the compiling argument list look like this:

 gcc -o cGraphics1.exe "src\\cGraphics1.o" 
2 Answers
Related