Re: Segmentation fault in creating basic app using GTK+ (with C)
- From: Tadej Borovšak <tadeboro gmail com>
- To: Anoop SN <neemanoop gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Segmentation fault in creating basic app using GTK+ (with C)
- Date: Sat, 05 Jul 2014 09:51:50 +0200
Hi!
Dne 05.07.2014 (sob) ob 12:54 +0530 je Anoop SN napisal(a):
int main(int argc, char *argv[])
{
//Decleration
GtkWidget *window;
GtkWidget *calButton;
GtkWidget *textEntry;
GtkWidget *label;
GtkWidget *grid;
struct mulptr *p = (struct mulptr *)malloc(sizeof(struct
mulptr));
p->one = textEntry;
p->two = label;
You have problems with C, not with GTK+. textEntry and label are
uninitialized here (p->one and p->two contain garbage at this point).
You need to create widgets first and only then copy pointers to
structure.
Also, adding -Wall to gcc arguments will warn you about this.
Cheers,
Tadej
--
Tadej Borovšak
tadej borovsak gmail com
tadeboro gmail com
blog.borovsak.si
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]