Chat on IRC |
gtk+
Posted by grandsnafu [send private reply] at July 23, 2001, 07:22:54 PM
I'm writing a program in c, and using gtk+. I have a certain function that is making my compiler (gcc 2.96) very angry. It says that gtkwidget and rndtxt are undeclared, there is parse error before 'int', and that rn and rndstr are undeclared. '// Gstring *rndstr = g_string_new("");' is commented because gstring and g_string_new were also "undeclared". Another function in the same file uses the same commands and compiles fine. I'm not sure if the c code or gtk+ code is off. Does anybody spot any problems, or have any experience with gtk+?
void on_btnRand_clicked (GtkButton *button, gpointer user_data) { /* Rand Generator Function */ Gtkwidget *rndtxt; int rn; // Gstring *rndstr = g_string_new(""); srand(time(NULL)); rndtxt = lookup_widget(GTK_WIDGET(button), "txtRand"); rn = rand() % 95; g_string_sprintfa(rndstr, "%c", rn); gtk_entry_set_text(GTK_ENTRY(rndtxt), rndstr->str); gtk_widget_show(create_wndRand()); }
Posted by Psion [send private reply] at July 23, 2001, 05:54:50 PM
C is a case-sensitive language. Gtkwidget and GtkWidget are not the same identifier.
Posted by grandsnafu [send private reply] at July 23, 2001, 07:18:25 PM
You're a genius Psion. I bow to you. After changing Gtkwidget to GtkWidget, and Gstring to GString, everything works...except, of course, for the rest of my function. But that can be fixed.
*grandsnafu applauds Psion for his grace and wisdom*
Posted by lordaerom [send private reply] at July 23, 2001, 08:47:59 PM
Changing your GString can prevent many problems.
Posted by grandsnafu [send private reply] at July 23, 2001, 10:28:52 PM
lol!!! :-)
Register as a new user | |||||||