GTK+ program on Raspberry Pi |
$ sudo apt-get install libgtk2.0-dev
After installed, create our first GTK+ program, name it hellogtk.c
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return(0);
}
Enter the command to compile hellogtk.c:
$ gcc hellogtk.c -o hellogtk `pkg-config --cflags --libs gtk+-2.0`
Run the generated program:
$ ./hellogtk
./hellogtk |
Next:
- Modified "Hello GTK+" to terminal application when the GtkWindow is destroyed, and add a button to print something.
Related:
- Install GTK+ 3.0 on Raspberry Pi
No comments:
Post a Comment