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

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

 



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@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux