GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 7:06 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 
Offline

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

Code:
#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 */
    d_string=gtk_entry_get_text(GTK_ENTRY(textValue));

    gtk_label_set_text(GTK_LABEL(display),d_string);
}

G_MODULE_EXPORT void on_exitButton_clicked(GtkButton *button,gpointer *data)
{
    gtk_main_quit();
}

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

    gtk_init(&argc, &argv);

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

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

    /* connect signal handlers */
    glade_xml_signal_autoconnect(xml);

    /*show widget*/
    gtk_widget_show (widget);

    gtk_main();

    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) ===|


Top
 Profile  
 
 Post subject: Re: compilation errors in a simple gtk project
PostPosted: Mon Jul 14, 2014 7:26 pm 
Offline
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?


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

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

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.

_________________
E.


Top
 Profile  
 
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 Adsense [Bot] and 4 guests


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