code https://docs.gtk.org/gtk3 Template **main method way** ```c #include #include void gtk_main_quit1() { gtk_main_quit(); printf("Inside quit"); } int main(int argc,char **argv) { printf("hello world 12"); gtk_init(&argc,&argv); int a=12; int b=13; GtkWidget *window; // gtk_window_new(type) here type can be pop window or top level window = gtk_window_new(GTK_WINDOW_TOPLEVEL); // callback function // 1st para is instance,2nd is detail,3rd is callback function handler, 4th is data to be passed to call back function // gtk_main_quit will quit the gtk_main program g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit1),NULL); // show all gtk widgets that are created. window is parent widget gtk_widget_show_all(window); gtk_main(); return 0; } ``` Compile it with ```bash gcc `pkg-config --cflags gtk+-3.0` -o main1 main.c `pkg-config --libs gtk+-3.0` ``` Run it with `./main1`     Better without infinite loop(**gtk application way**) ```c #include static void activate(GtkApplication *app,gpointer user_data) { // gtk code comes here GtkWidget *window; window= gtk_application_window_new(app); gtk_widget_show_all(window); } int main(int argc,char **argv) { GtkApplication *app; int ret; int as=12; // 1st para ie application name should have atleast one dot(.) character app= gtk_application_new("in.firstApp23",G_APPLICATION_FLAGS_NONE); // G_APPLICATION_FLAGS_NONE is enum whose value is 0 // app= gtk_application_new("firstApp",G_APPLICATION_DEFAULT_FLAGS); g_signal_connect(app,"activate",G_CALLBACK(activate),NULL); ret=g_application_run(G_APPLICATION(app),argc,argv); g_object_unref(app); return ret; } ``` here `app` argument in `g_application_run` have to be type casted using `G_APPLICATION(app)` and `activate` function in gtk_application_new too have to be type casted using `G_CALLBACK(activate)`