Re: error: expected primary-expression before ‘) ’ token cast issue



This is an issue with the syntax in the code you wrote, not with GTK+. As such, pseudo-code won't really help us find the issue, nor is gtk-list an appropriate place to ask for help. Giving us your real code might help us figure out why the compile error happens, but we understand that this might be an issue for you.

On Sat, Aug 2, 2014 at 11:14 AM, Bill Brown <wbrown338 comcast net> wrote:
Hello.  I'm trying to figure out why I get a compile error (in the subject of this message) for this cast during the initialization of a struct member variable.

in myclass.h

class MyClass {
    ...
    public:
        struct cpresets {
            char* soundfont_key;
            char* exists;
            UT_hash_handle hh;
        };
    ...
};
in myclass.cc

void myclass::mymethod() {
    ...
    struct cpresets *newpreset;
    newpreset = (cpresets*) malloc(sizeof( cpresets));
    ...

}
There is another place in the cc file where this works.

in myclass.cc

...
typedef struct {
    ...
}mystruct;

...

static instantiate(){
    ...
    //this line causes the compile error
    mystruct* me = (mystruct*) malloc(sizeof(mystruct));
    ...
}
I see the difference in the case where it works is that the struct is defined in the cc file and in the case where it doesnt work, the struct is a member vairable of the class header. Do you know why this is an issue or what I might be able to do to fix it?

Thanks.
Bill.

_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list




--
  Jasper


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]