Re: Linking problems - newbie problems



On Wed, 2008-12-24 at 15:56 +0530, sasank kuntimaddi wipro com wrote:
> 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`

You need to pass an output file to the -o option:

gcc -o my_window my_window.cpp ...

--
Shaun





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