Linking problems - newbie problems



Hi,
 
I am new to programming with GTK and am trying to create a small test window. I am getting a linker errors. Can someone please suggets me a solution for this.
 
The code in my program is:
 
#include <gtk/gtk.h>
 
static GtkWidget *main_window;
 
static void destroy(GtkWidget *widget gpointer data)
{
 gtk_main(quit);
}
 
int main(int argc, char *argv[])
{
 gtk_init(&argc, &argv);
 main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(main_window), "Sasank");
 g_signal_connect(G_OBJECT(main_window),"destroy",G_CALLBACK(destroy,NULL);
 gtk_widget_show_all(GTK_WIDGET(main_window));
 gtk_main();
 return 0;
}
The code is compiled using =>  gcc -o  my_window.cpp `pkg-config --cflags --libs gtk+-2.0`
 
The errors I get are:
/usr/lib/gcc/i586-suse-linux/4.3/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_event_request_motions'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_beep'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_color_to_string'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_idle'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_idle_full'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_thaw_toplevel_updates_libgtk_only'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_set_opacity'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_set_startup_id'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_timeout'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_timeout_full'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_freeze_toplevel_updates_libgtk_only'
/usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_notify_startup_complete_with_id'
collect2: ld returned 1 exit status
linux-ls4f:/ #
 
Regards



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