程序:
callback_sendKeyword (GtkWidget *widget, GtkWidget *entry)
{
gchar *entry_text;
printf ("Confirm button pressed\n");
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
printf ("Entry contents: %s\n", entry_text);
}
编译时提示:
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));此行
warning: fix for: assignment discards qualifiers from pointer target type
百思不得其解,查了查gtk_entry_get_text()接口定义如下:
gtk_entry_get_text ()
const gchar* gtk_entry_get_text (GtkEntry *entry);
Retrieves the contents of the entry widget. See also gtk_editable_get_chars().
entry : a GtkEntry
Returns : a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.
将程序中
gchar *entry_text;
改为
const char *entry_text;
无此警告。
阅读(1340) | 评论(0) | 转发(0) |