c++ - "Undefined struct" error when creating an object -
i'm working on c++ project links c library. c++ class follows:
extern "c" { struct __struct1__; struct __struct2__; struct __struct3__; struct __struct4__; } namespace mynamespace { class myclass : public parent { public: .... private: .... __struct1__* s1; __struct2__* s2; struct __struct3__ s3; struct __struct4__ s4; }; }
when creating pointers s1 , s2, ok. objects don't work well. following error generated:
error using undefined struct
how can create objects s3 , s4?
variable:
__struct1__ *s1
is of type pointer (to structure, still pointer), compiler knows how memory on stack variable needs. in case of:
__struct3__ s3
this variable of type __struct3__, without whole definition compiler not know size.
Comments
Post a Comment