invalid application of ‘sizeof’ to incomplete type

sizeof 后面所跟的数据类型没有定义,或者找不到定义的地方

 

eg:

头文件中定义结构体如下:

struct PersonaL{

   char name[];

        int  age;

};

但是在cpp中使用时如下:

struct personal a;

int len = sizeof(a);

 

posted @ 2019-05-30 16:54  hbg-rohens  阅读(4958)  评论(0编辑  收藏  举报