gnucobol-users
[Top][All Lists]
Advanced

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

[open-cobol-list] OC_GTK help


From: Michael
Subject: [open-cobol-list] OC_GTK help
Date: Fri, 03 Jul 2009 23:50:59 -0500
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

I've been trying to make use of OpenCobol with GTK. I've compiled ocgtk.c, and ocgtkhtml.cob.
i get the following errors:
ocgtk.o:ocgtk.c:(.text+0x147): undefined reference to `_G_CALLBACK'
ocgtk.o:ocgtk.c:(.text+0x154): undefined reference to `_G_OBJECT'
ocgtk.o:ocgtk.c:(.text+0x170): undefined reference to `_g_signal_connect'
ocgtk.o:ocgtk.c:(.text+0x194): undefined reference to `_gtk_type_check_object_cast'

What am I missing?

Platform cygwin on WinXP Pro.

I've successfully compiled and executed the follow GTK "C" program: so I know I have GTK installed correctly:

/*
*File name: hbox.c
*/

#include <gtk/gtk.h>
#include <glib.h>

/*-- 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;
}




--
Michael Anderson,
J3k Solutions
Sr.Systems Programmer/Analyst
832.515.3868



reply via email to

[Prev in Thread] Current Thread [Next in Thread]