完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个头文件,其中包含以下代码……在我的.c文件中,在main...之前,我有,在main中,我有...代码已经被删除了,所以这就是为什么它看起来没有真正执行任何操作。我的问题是,我得到一个错误“error:在每个案例行和其他地方使用未定义类型‘struct._._test’无效。.h文件包含在..c文件中,以及在.h文件中声明的其他变量。有没有想过我做错了什么?谢谢。
以上来自于百度翻译 以下为原文 I have a header file with the following code in it... typedef enum { testExternalEncoderIrRunning, testExternalEncoderIrSilent, testMountedDetectorIrRunningFront, testMountedDetectorIrRunningRear, testMountedDetectorIrSilent }stand_alone_status; typedef enum { FALSE = 0, TRUE = 1 }boolean; struct stand_alone_tests { int statusCounter; stand_alone_status testStatus; boolean testSuccessful; }; extern struct stand_alone_test standAloneTest; In my .c file, I have, before main... struct stand_alone_test standAloneTest; and in main, I have... switch(standAloneTest.testStatus) { case(stand_alone_status.testMountedDetectorIrRunningFront): if(standAloneTest.statusCounter > 1000) { standAloneTest.testStatus = stand_alone_status.testMountedDetectorIrRunningRear; standAloneTest.statusCounter = 0; } break; case(stand_alone_status.testMountedDetectorIrRunningRear): if(standAloneTest.statusCounter > 1000) { standAloneTest.testStatus = stand_alone_status.testMountedDetectorIrSilent; standAloneTest.statusCounter = 0; } break; case(stand_alone_status.testMountedDetectorIrSilent): if(standAloneTest.statusCounter > 1000) { standAloneTest.testStatus = stand_alone_status.testMountedDetectorIrRunningFront; standAloneTest.statusCounter = 0; } break; default: standAloneTest.testStatus = stand_alone_status.testMountedDetectorIrRunningFront; standAloneTest.statusCounter = 0; break; } The code has been stripped, so that's why it doesn't look like it does anything really. My issue is, I get an error "error: invalid use of undefined type 'struct stand_alone_test' on each of the case lines and in other places. The .h file is included in my .c file, and other variables declared in the same .h file work. Any thoughts on what I'm doing wrong? Thanks. |
|
相关推荐
2个回答
|
|
啊,好抓,但这不是全部。我仍然在线路上得到同样的错误…
以上来自于百度翻译 以下为原文 Ah, good catch, but that's not all of it. I still get the same error on the lines... standAloneTest.testStatus = stand_alone_status.testMountedDetector... |
|
|
|
就是这样。我认为我把VB.NET与C混淆了。我不经常用它们来编程,所以我很容易把它们弄糊涂。谢谢。
以上来自于百度翻译 以下为原文 That's it. I think I was confusing vb.net with c. I don't often program with either so it's easy for me to get them confused. Thanks. |
|
|
|
只有小组成员才能发言,加入小组>>
5163 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 20:53 , Processed in 1.103952 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号