I know this question has been answered several times, I have tried each of them but still could not find the exact solution. I am starting to learn GTK + 3.0 with Glade User Interface. i know Glade will generate XML for the design and the same XML can be used in our c/cpp program. But to execute the program, one must have all the libraries installed or path must be set to the libraries in IDE's. I am using Anjuta IDE for developing this program whenever i tried to build the program I get the following error.
gtk/gtk.h: No such file or directory
Program code
#include <gtk/gtk.h>!
#include <glade/glade.h>
void
ok_button_clicked (GtkWidget *widget, gpointer user_data)
{
printf ("Thanks for trying out my program.\n");
gtk_main_quit ();
}
int main (int argc, char *argv[])
{
GladeXML *main_window;
GtkWidget *widget;
gtk_init (&argc, &argv);
/* load the interface */
main_window = glade_xml_new ("example-1.glade", NULL, NULL);
/* connect the signals in the interface */
/* Have the ok button call the ok_button_clicked callback */
widget = glade_xml_get_widget (main_window, "OKButton");
g_signal_connect (G_OBJECT (widget), "clicked",
G_CALLBACK (ok_button_clicked),
NULL);
/* Have the delete event (window close) end the program */
widget = glade_xml_get_widget (main_window, "MainWindow");
g_signal_connect (G_OBJECT (widget), "delete_event",
G_CALLBACK (gtk_main_quit), NULL);
/* start the event loop */
gtk_main ();
return 0;
}
Whenever I try to add Lib or External Lib, I am not able to add gtk/gtk.h
file, The same file is already there in /usr/include/gtk-3.0/gtk/gtk.h
and when I try to copy the same in libanjuta
the same code still giving the same error, Any help will be highly appreciated friends, I am struggling lot to execute the program ..
Thanks Amul Bhatia
If you just want to compile it and run other than making a makefile
save this file in the link beside your foobar.c file as example-1.glade
https://github.com/interval1066/XFC/blob/master/examples/glade/example-1/example-1.glade
and open terminal and switch to directory containing foobar.c and example-1.glade and issue this line
and run the binary
Or if you insist on compiling it with makefile, replace your makefile with this one
I tested above instructions in my system, it works.