Compilation Problem - Linux

This is a discussion on Compilation Problem - Linux ; Hello I have redhat linux 9.1 I have installed Gnome Development Kit which is there in the distribution CDs. I am trying to compile following file. But I am facing some problem with it. I have tried almost every GCC ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Compilation Problem

  1. Compilation Problem

    Hello
    I have redhat linux 9.1
    I have installed Gnome Development Kit which is there in the
    distribution CDs.
    I am trying to compile following file.
    But I am facing some problem with it.
    I have tried almost every GCC option that I know.
    For example,First it was giving error as gtk.h not found.
    So I used -I option to specify the directory which contains gtk.h
    Later someone told me to give the comman as
    gcc -Wall -g window.c -o window `gtk-config --cflags` `gtk-config
    --libs`
    But it didnot solve the problem also.
    But instead of removing the errors,it generated too many errors to
    count.
    Please help me out as soon as possible.
    Thank you

    <<>>>
    /*
    *File name: hbox.c
    */


    #include
    #include


    /*-- This function allows the program to exit properly when the window
    is closed --*/
    gint destroyapp (GtkWidget *widget, gpointer gdata)
    {
    g_print ("Quitting...\n");
    gtk_main_quit();
    return (FALSE);



    }


    /*-- This function responds to the mouse click on the button --*/
    void button_clicked(GtkWidget *widget, gpointer gdata)
    {
    g_print("Button was clicked.\n");


    }


    int main (int argc, char *argv[])
    {
    /*-- Declare the GTK Widgets used in the program --*/
    GtkWidget *window;
    GtkWidget *label1;
    GtkWidget *label2;
    GtkWidget *label3;
    GtkWidget *button1;
    GtkWidget *button2;
    GtkWidget *button3;
    GtkWidget *hbox;

    /*-- Initialize GTK --*/
    gtk_init (&argc, &argv);


    /*-- Create the new window --*/
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);


    /*-- Create the labels --*/
    label1 = gtk_label_new("Label1");
    label2 = gtk_label_new("Label2");
    label3 = gtk_label_new("Label3");


    /*-- Create some buttons to fill the vbox with --*/
    button1 = gtk_button_new_with_label("Button 1");
    button2 = gtk_button_new_with_label("Button 2");
    button3 = gtk_button_new_with_label("Button 3");


    /*-- Create the hbox --*/
    hbox = gtk_hbox_new(FALSE,0);


    /*-- Connect the window to the destroyapp function --*/
    gtk_signal_connect(GTK_OBJECT(window), "delete_event",
    GTK_SIGNAL_FUNC(destroyapp), NULL);


    /*-- Connect all the buttons to the button_was_clicked function --*/
    gtk_signal_connect(GTK_OBJECT(button1), "clicked",
    GTK_SIGNAL_FUNC(button_clicked), NULL);
    gtk_signal_connect(GTK_OBJECT(button2), "clicked",
    GTK_SIGNAL_FUNC(button_clicked), NULL);
    gtk_signal_connect(GTK_OBJECT(button3), "clicked",
    GTK_SIGNAL_FUNC(button_clicked), NULL);


    /*-- Add all the buttons to the vbox --*/
    gtk_box_pack_start(GTK_BOX(hbox), label1, FALSE, FALSE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), button1, FALSE, FALSE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), label2, FALSE, FALSE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), button2, FALSE, FALSE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), label3, FALSE, FALSE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), button3, FALSE, FALSE, 2);


    /*-- Add the button to the window --*/
    gtk_container_add(GTK_CONTAINER (window), hbox);


    /*-- Add a border to the window to give the buttons a little room
    --*/
    gtk_container_border_width (GTK_CONTAINER (window), 15);


    /*-- Display the widgets --*/
    gtk_widget_show(hbox);
    gtk_widget_show(label1);
    gtk_widget_show(label2);
    gtk_widget_show(label3);
    gtk_widget_show(button1);
    gtk_widget_show(button2);
    gtk_widget_show(button3);
    gtk_widget_show(window);


    /*-- Start the GTK event loop --*/
    gtk_main();


    /*-- Return 0 if exit is successful --*/
    return 0;



    }


    <<<>>>

    There is yet another file,with which I am facing some problem,I am
    giving that file as well.


    <<>>>


    /*
    *File name: window.c
    gcc -Wall -g window.c -o window `gtk-config --cflags` `gtk-config
    --libs`
    */


    #include
    #include


    int main (int argc, char *argv[])
    {
    /*-- Declare the GTK Widgets used in the program --*/
    GtkWidget *window;


    /*-- Initialize GTK --*/
    gtk_init (&argc, &argv);


    /*-- Create the new window --*/
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);


    /*-- Display the window --*/
    gtk_widget_show(window);


    /*-- Start the GTK event loop --*/
    gtk_main();


    /*-- Return 0 if exit is successful --*/
    return 0;



    }


    <<<>>>


  2. Re: Compilation Problem

    In comp.os.linux.development.system Prafulla T :

    [ snip multi posted question ]

    Please stop multi posting, cross-post if you think it is needed.

    Good luck

    BTW
    If unsure what the fuzz is about, try the post that occurs just
    below your similar to colm ("A new reader?..."), which I just
    tried to answer, just to reread it here again. ;(

    --
    Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
    mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
    #bofh excuse 211: Lightning strikes.

+ Reply to Thread