GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 24, 2016 11:57 am

All times are UTC

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: compilation errors in a simple gtk project
PostPosted: Sun Jul 13, 2014 2:48 pm 

Joined: Sun Jul 13, 2014 5:18 am
Posts: 1
when i compile the following project in codeblocks i get a number of errors which are listed after the code.please help me find a solution,its been 48 hrs since iam working on this thing.thnx in advance

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

GladeXML *xml;
GtkWidget *widget;
GtkWidget *display;
GtkWidget *textValue;

gchar *d_string;

G_MODULE_EXPORT void on_displayButton_clicked(GtkButton *button,gpointer *data)

    /* Pull the widgets out of the tree */
    display= glade_xml_get_widget(xml, "displayLabel");

    textValue= glade_xml_get_widget(xml, "textEntry");

    /* Get the string value form the Entry widgets */


G_MODULE_EXPORT void on_exitButton_clicked(GtkButton *button,gpointer *data)

int main(int argc, char *argv[])

    gtk_init(&argc, &argv);

    /*import glade file*/
    xml = glade_xml_new("", NULL, NULL);

    /* get a widget (useful if you want to change something) */
    widget = glade_xml_get_widget(xml, "mainWindow");

    /* connect signal handlers */

    /*show widget*/
    gtk_widget_show (widget);


    return 0;

obj\Debug\main.o||In function `on_displayButton_clicked':|
C:\Users\Mehak\Desktop\try\main.c|24|undefined reference to `glade_xml_get_widget'|
C:\Users\Mehak\Desktop\try\main.c|26|undefined reference to `glade_xml_get_widget'|
obj\Debug\main.o||In function `main':|
C:\Users\Mehak\Desktop\try\main.c|45|undefined reference to `glade_xml_new'|
C:\Users\Mehak\Desktop\try\main.c|48|undefined reference to `glade_xml_get_widget'|
C:\Users\Mehak\Desktop\try\main.c|51|undefined reference to `glade_xml_signal_autoconnect'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|

 Post subject: Re: compilation errors in a simple gtk project
PostPosted: Mon Jul 14, 2014 7:26 pm 
Familiar Face

Joined: Fri Nov 28, 2008 8:48 pm
Posts: 5
what command you use to compile the project? how you linking the libglade?

 Post subject: Re: compilation errors in a simple gtk project
PostPosted: Sat Jul 19, 2014 10:40 am 
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 1045
Location: UK

These errors are because you are not linking with the Libglade library.

As a note the libglade library is heading towards deprecations and you should use GtkBuilder which has been built into the GTK+ library since v2.12

The way that GtkBuilder is used is very similar to libglade so conversion should not be that hard.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group