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 Nov 26, 2014 8:20 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: error : use Glade vs gtk
PostPosted: Mon Mar 18, 2013 6:37 pm 
Offline
Familiar Face

Joined: Mon Mar 18, 2013 5:59 pm
Posts: 6
Hello !
im want create app with glade vs gtk but when compile have proplem:
new.c:3:25: fatal error: glade/glade.h: No such file or directory ( althought i have glade.h in
src/include/libglade-2.0/glade )

this is main.c
#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)
{

display= glade_xml_get_widget(xml, "displayLabel");

textValue= glade_xml_get_widget(xml, "textEntry");


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


xml = glade_xml_new("TextEntry.glade", NULL, NULL);


widget = glade_xml_get_widget(xml, "mainWindow");


glade_xml_signal_autoconnect(xml);


gtk_widget_show (widget);

gtk_main();

return 0;
}


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Mon Mar 18, 2013 7:03 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 780
Location: UK
Hello and welcome,

You do not say what versions of the libraries you are using and what version of Glade. This makes a big difference.

The most likely problem is that you have most added the libglade headers and libraries to the search path.

Note that libglade has been replaced with GtkBuilder which is part of GTK+ since version 2.12 and the latest version in the 2 series is 2.24

_________________
E.


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Tue Mar 19, 2013 4:05 am 
Offline
Familiar Face

Joined: Mon Mar 18, 2013 5:59 pm
Posts: 6
errol wrote:
Hello and welcome,

You do not say what versions of the libraries you are using and what version of Glade. This makes a big difference.

The most likely problem is that you have most added the libglade headers and libraries to the search path.

Note that libglade has been replaced with GtkBuilder which is part of GTK+ since version 2.12 and the latest version in the 2 series is 2.24


i use glade 3.8 vs libglade 2.0 gtk-2.0
first,, i desgin a window by glade and save it is "text.glade"
then code main.c that i post before
and code this in terminal : gcc -o main main.c `pkg-config --cflags --libs gtk+-2.0 gmodule-2.0` error glade/glade.h not such ....


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Tue Mar 19, 2013 6:37 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 780
Location: UK
You have only told me the version of Glade and not what version of the libraries you want to use. Glade v3.8 is the last version that can be used with the GTK+ 2 series. To find out what version of GTK+ you are using type the follow on the command line :-
Code:
pkg-config --modversion gtk+-2.0


The cause of your error is that you are not linking in the libglade libraries and headers. You will need to use something like this to correct your command line to compile your code. (Note untested as my system does not have libglade on it and I have not used it since 2010)
Code:
gcc -o main main.c `pkg-config --cflags --libs gtk+-2.0 gmodule-2.0 libglade-2.0`

Please avoid the use of libglade in all new code as its use has been deprecated in 2009 with GTK+ version 2.12. Libglade has not been maintained any more since 2009 so use GtkBuilder instead.

_________________
E.


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Tue Mar 19, 2013 9:43 am 
Offline
Familiar Face

Joined: Mon Mar 18, 2013 5:59 pm
Posts: 6
errol wrote:
You have only told me the version of Glade and not what version of the libraries you want to use. Glade v3.8 is the last version that can be used with the GTK+ 2 series. To find out what version of GTK+ you are using type the follow on the command line :-
Code:
pkg-config --modversion gtk+-2.0


The cause of your error is that you are not linking in the libglade libraries and headers. You will need to use something like this to correct your command line to compile your code. (Note untested as my system does not have libglade on it and I have not used it since 2010)
Code:
gcc -o main main.c `pkg-config --cflags --libs gtk+-2.0 gmodule-2.0 libglade-2.0`

Please avoid the use of libglade in all new code as its use has been deprecated in 2009 with GTK+ version 2.12. Libglade has not been maintained any more since 2009 so use GtkBuilder instead.



hi ! now i want use gtkbuilder :)
but can you teach me how to use callback ...i try but failed ...i dont know how to find a entry , get string this entry that i input then show in the textview


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Tue Mar 19, 2013 10:04 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 780
Location: UK
Showing how to use GtkBuilder can take up a whole book.

Micah's tutorial on using Glade and GtkBuilder is very good http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html and there are more resources and links to tutorials here http://www.gtkforums.com/viewtopic.php?f=3&t=988 on this forum.

Hope these help you get started and find what you need.

_________________
E.


Top
 Profile  
 
 Post subject: Re: error : use Glade vs gtk
PostPosted: Tue Mar 19, 2013 10:43 am 
Offline
Familiar Face

Joined: Mon Mar 18, 2013 5:59 pm
Posts: 6
errol wrote:
Showing how to use GtkBuilder can take up a whole book.

Micah's tutorial on using Glade and GtkBuilder is very good http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html and there are more resources and links to tutorials here http://www.gtkforums.com/viewtopic.php?f=3&t=988 on this forum.

Hope these help you get started and find what you need.

thanks so much !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users 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