完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在编译中得到这个错误,我不知道为什么。通常情况下,我相信这是由前声明引起的,但我没有这么做。至少我不这么认为。如果将MsgGScript更改为指针,它会修复错误,但我不想使用指针。下面是导致错误的代码:这里是PBHistRAMAMT FROMPBEnCODEF的声明。这可能是由于PBSistRAMAMS的声明中使用PBSistReAMAMT引起的吗?(如果是的话,有没有办法绕过?)
以上来自于百度翻译 以下为原文 I'm getting this error on compile and I don't know why. Normally I believe this would be caused by a forward declaration but I'm not doing that. At least I don't think I am. If I change mMsgStream to a pointer it fixes the error but I don't want to use pointers here. Here's the code causing the error: #include #include "pb_encode.h" #include "CIM2Operator2ConsoleControls.pb.h" #include "CI2CPort.h" class CCIM2Operator2ConsoleControls{ public: CCIM2Operator2ConsoleControls(); CCIM2Operator2ConsoleControls(const CCIM2Operator2ConsoleControls& orig); virtual ~CCIM2Operator2ConsoleControls(); void Init(); int GetControls(uint8_t** data); void DoTasks(); private: CI2CPortsBus mI2CPorts; msgCIM2Operator2ConsoleControls mMsg; pb_istream_t mMsgStream; //ERROR HERE uint8_t mMsgBuffer[256]; }; And here's the declaration of pb_istream_t from pb_encode.htypedef struct pb_istream_s pb_istream_t; struct pb_istream_s { bool (*callback)(pb_istream_t *stream, uint8_t *buf, size_t count); void *state; /* Free field for use by callback implementation */ size_t bytes_left; const char *errmsg; }; Could this maybe be caused by the use of pb_istream_t within the declaration of pb_istream_s? (If so, is there any way to get around that?) |
|
相关推荐
4个回答
|
|
如果你给……就好了。无论如何,您的PBHistRAMAMS声明有一个PBHistRAMAMS指针的调用(BACK),而PBSistRAMAMS的声明还没有完成。我确信它将与一些“空洞*流”调用参数一起工作,所以这可能是一个“出路”。
以上来自于百度翻译 以下为原文 Would be nice if you gave the .... too. Anyway: your pb_istream_s declaration has a call(back) with a pb_istream_s pointer while the declaration of pb_istream_s is not yet complete. I'm quite sure it will work with some 'void *stream' call parameter, so this might be a 'way out'. |
|
|
|
对不起,“…”ISMMSGFISH。错误代码在代码中用注释标出……是的,这就是我所想的。谢谢,我现在可以处理这个了。
以上来自于百度翻译 以下为原文 Sorry, the "..." is mMsgStream. The error line is marked with a comment in the code... Yeah, that's what I thought it might be. Thanks, I can work through this now. |
|
|
|
只是一个次要问题,您不需要虚拟析构函数。该类没有虚拟成员。
以上来自于百度翻译 以下为原文 just a side issue, you do not want a virtual destructor. The class has no virtual members. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5212 浏览 9 评论
2019 浏览 8 评论
1944 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3192 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2246 浏览 5 评论
760浏览 1评论
647浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
567浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
659浏览 0评论
557浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-12 07:57 , Processed in 2.749884 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号