I am writing a program in C++ which creates a GTK Window and should get input from the user. (But it's not working!)
The line which is causing the problem is:
textP = gtk_entry_get_text(GTK_ENTRY(entry_name));
textP is a tempoary variable which I created for debugging.
The terminal output looks like this:
Segmentation fault (core dumped)
Process returned 139 (0x8B) execution time : 2.252 s
Press ENTER to continue.
(I am working in Code::Blocks or with g++ command line.)
Other relevent pieces of code:
GtkEntryBuffer *entry_name_buffer; // Entry buffer for user input
const gchar* textP; // The string to hold the entry text
GtkWidget *entry_name; // The entry widget which will hold the persons name
entry_name_buffer = gtk_entry_buffer_new(NULL, 0);
entry_name = gtk_entry_new_with_buffer(entry_name_buffer);
And I want to be able to do something like:
std::string any_old_string = gtk_entry_get_text(GTK_ENTRY(entry_name));
A button calls a function which is supposed to transfer the text in the gtk entry (textbox thing) to a string which can be used elsewhere in my program.
Thanks, Edward Bird.