invalid application of ‘sizeof’ to incomplete type ‘FluentIconBase’ 智能指针

项目场景:

invalid application of ‘sizeof’ to incomplete type ‘FluentIconBase’
使用智能指针时编译器报错
在这里插入图片描述


问题描述

智能指针定义:

private:
QScopedPointer < FluentIconBase>m_ficon;


解决方案:

参考了https://forum.qt.io/topic/84059/invalid-application-of-sizeof-to-incomplete-type-qvariant
添加对应头文件
在这里插入图片描述

类似的:

报错:也是缺少相应头文件
在这里插入图片描述

LinkList.h: In function 'LinkNode* Init_LinkList()': LinkList.h:6:54: error: invalid application of 'sizeof' to incomplete type 'LinkNode' 6 | struct LinkNode *header=(struct LinkNode*)malloc(sizeof(struct LinkNode)); | ^~~~~~~~~~~~~~~~~~~~~~~ LinkList.h:7:11: error: invalid use of incomplete type 'struct LinkNode' 7 | header->data=-1; | ^~ LinkList.h:4:8: note: forward declaration of 'struct LinkNode' 4 | struct LinkNode *Init_LinkList(){ | ^~~~~~~~ LinkList.h:8:11: error: invalid use of incomplete type 'struct LinkNode' 8 | header->next=NULL; | ^~ LinkList.h:4:8: note: forward declaration of 'struct LinkNode' 4 | struct LinkNode *Init_LinkList(){ | ^~~~~~~~ LinkList.h:13:5: error: 'val' was not declared in this scope 13 | val=1; | ^~~ LinkList.h:15:55: error: invalid application of 'sizeof' to incomplete type 'LinkNode' 15 | struct LinkNode *newnode=(struct LinkNode*)malloc(sizeof(struct LinkNode)); | ^~~~~~~~~~~~~~~~~~~~~~~ LinkList.h:16:12: error: invalid use of incomplete type 'struct LinkNode' 16 | newnode->data=val; | ^~ LinkList.h:4:8: note: forward declaration of 'struct LinkNode' 4 | struct LinkNode *Init_LinkList(){ | ^~~~~~~~ LinkList.h:17:12: error: invalid use of incomplete type 'struct LinkNode' 17 | newnode->next=NULL; | ^~ LinkList.h:4:8: note: forward declaration of 'struct LinkNode' 4 | struct LinkNode *Init_LinkList(){ | ^~~~~~~~ LinkList.h:20:10: error: invalid use of incomplete type 'struct LinkNode' 20 | pRear->next=newnode | ^~ LinkList.h:4:8: note: forward declaration of 'struct LinkNode' 4 | struct LinkNode *Init_LinkList(){ | ^~~~~~~~ LinkList.h:24:1: warning: no return statement in function
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值