Skip to content

Instantly share code, notes, and snippets.

@makotokato
Created February 28, 2025 10:22
Show Gist options
  • Save makotokato/cb5be44570211d377f9c28fe8823927a to your computer and use it in GitHub Desktop.
Save makotokato/cb5be44570211d377f9c28fe8823927a to your computer and use it in GitHub Desktop.
GTK4 with textbox
// gcc main.c `pkg-config --cflags --libs gtk4` Too many errors emitted, stopping now
#include <gtk/gtk.h> 'gtk/gtk.h' file not found
static void activate(GApplication* app, gpointer user_data) { Unknown type name 'gpointer'
GtkWidget* window = gtk_window_new(); Call to undeclared function 'gtk_window_new'; ISO C99 and later do not support implicit function declarations
gtk_window_set_application(GTK_WINDOW(window), GTK_APPLICATION(app)); Use of undeclared identifier 'window'
GtkWidget* entry = gtk_entry_new(); Call to undeclared function 'gtk_entry_new'; ISO C99 and later do not support implicit function declarations
gtk_entry_set_input_hints(GTK_ENTRY(entry), GTK_INPUT_HINT_PRIVATE); Use of undeclared identifier 'GTK_INPUT_HINT_PRIVATE'
gtk_window_set_child(GTK_WINDOW(window), entry); Use of undeclared identifier 'entry'
gtk_window_present(GTK_WINDOW(window));
}
int main (int argc, char* argv[]) {
GtkApplication* app = gtk_application_new(NULL, G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect(G_OBJECT(app), "activate", G_CALLBACK(activate), NULL);
return g_application_run(G_APPLICATION(app), argc, argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment