完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在研究一个使用PIC18F25K50的项目,它具有USB和XC8编译器错误的问题,XC8 1.42或1.43,但不是1.41FIFO.C:23:错误:(1098)变量的声明“变量FIFOOSIIT”(函数:H:32)文件函数。H包含:无效FIFO-OIIT(Stutt FIFOOT**F)//初始化FIFO(文件内FIFO.C)文件Meal.C包含:FIFOSYinit(&SpRIti1IN);/init在FIFO(RX数据)中的Simult1。FinCion在另一个文件(FIFO.C)中,程序在1.41版本中编译和工作良好。上面的错误发生在版本1.42和1.43i没有尝试1.42时,它出来,但升级到1.43,当我看到它是可用的。当我得到这个错误的时候,我决定也得到1.42,试试看。什么会引起这个问题?我会继续使用第1.41版,直到我找到答案。谢谢!戈登
以上来自于百度翻译 以下为原文 I'm working on a project using a PIC18F25K50, with USB and having the following problem with the XC8 compiler error from XC8 1.42 or 1.43 but not 1.41 fifos.c:23: error: (1098) conflicting declarations for variable "_fifo_init" (functions.h:32) File funcions.h contains: void fifo_init(struct fifo_t *f); // initializes a fifo (in file fifos.c) File main.c contains: fifo_init(&SPIRIT1_in); // init the SPIRIT1 in fifo (RX data) The funcion is in another file (fifos.c) The program compiles and works fine in Version 1.41. The above error happens in versions 1.42 and 1.43 I had not tried 1.42 when it came out, but did upgrade to 1.43 when I saw that it was available. When I got the error I then decided to also get 1.42 and try that. What could be causing this problem? I will continue using version 1.41 until I can figure it out. Thanks! Gordon |
|
相关推荐
12个回答
|
|
忘了提到我用的是专业版,谢谢,戈登
以上来自于百度翻译 以下为原文 Forgot to mention that I'm using a Pro licensed version. Thanks, Gordon |
|
|
|
我不知道“灵魂1in”,但有一点是肯定的:如果SypIt1In不是“Strut Fioovit”,你在抱怨什么?我希望-否则编译器不会抱怨。如果类型检查等在V1.42/1.43中被改进(更严格),这是一件很好的事情。即使它首先让你恼火。因为将指针传递给“任何数据类型”(不匹配声明的数据类型)是在“垃圾”和“危险”之间。即使这种情况暂时有效。(尽管它可能插入类型为“(结构FIFOOT**)(&;SpILIT1IN))。
以上来自于百度翻译 以下为原文 I don't know about "SPIRIT1_in", but one for sure: If SPIRIT1_in is not of type "struct fifo_t", what are you complaining about ? And I expect that - otherwise the compiler wouldn't complain now. If type checking etc. improved (more stringent) in V 1.42/1.43, this is a really good thing. Even if it annoys you in the first place. Because passing pointers to "any data type" (not matching the data type declared) is between "garbage" and "risky". Even if this momentarily works. (Although it might be possible to insert the type cast "(struct fifo_t*)(&SPIRIT1_in)".) |
|
|
|
SpRITI1IN在该变量中声明为StultFIFOTHT,在变量。h FielyBythf结构中,FIFOYT{{int第一;int最后;int有效项;char数据[Max PiTase];};StuttFioOxt Studio1in;/SpuriT1输入FIFOI同意改进类型检查是一件好事,但这似乎不是C。因为我的错误,除非我不理解错误信息。(重复这里)FIFOS.C:23:错误:(1098)变量的声明“变量FIFOOSIIT”(函数H:32)FIFOOIN是函数名,而不是数据变量。我试着把函数名改为MFIFOOSIIT((结构FIFOOT**F),这没有什么区别,仍然在版本1.41中工作,在1.42和1.43中坏了。谢谢,戈登。
以上来自于百度翻译 以下为原文 SPIRIT1_in is declared as struct fifo_t in this line in the variables.h file typedef struct fifo_t { int first; int last; int validItems; char data[MAX_ITEMS]; }; struct fifo_t SPIRIT1_in; // SPIRIT1 input fifo I agree that improved type checking is a good thing, but that does not appear to be the cause of my error, unless I am not understanding the error message. (repeated here) fifos.c:23: error: (1098) conflicting declarations for variable "_fifo_init" (functions.h:32) fifo_int is the function name, not a data variable. I tried changing the function name to mfifo_init((struct fifo_t *f); This made no difference, still works in version 1.41 and broke in 1.42 and 1.43. Thanks, Gordon |
|
|
|
|
|
|
|
我已经在演示错误的项目中附加了4个文件,使用MPLAB X IDE 4和XC8版本1.41、1.42和1.43.项目编译为1.41,失败为1.42和1.43,谢谢,戈登
函数H(1.65 KB)-下载51次Meal.C(0.33 KB)-下载39次变量H(1.93 KB)-下载53次 以上来自于百度翻译 以下为原文 I have attached the 4 files in the project that demonstrate the error, Using MPLAB X IDE 4.00 and XC8 version 1.41, 1.42 and 1.43. the project compiles fine with 1.41 and fails with 1.42 and 1.43 Thank you, Gordon Attachment(s) fifos.c (0.37 KB) - downloaded 63 times functions.h (1.65 KB) - downloaded 51 times main.c (0.33 KB) - downloaded 39 times variables.h (1.93 KB) - downloaded 53 times |
|
|
|
你真的很有趣:“这是什么?”int?标题:因此,在FIFOS.C中添加空格并继续进行。
以上来自于百度翻译 以下为原文 You're really funny: From fifos.c fifo_init(struct fifo_t *f) { ... @ all: what is this ? int ? And the header: void fifo_init(struct fifo_t *f); // an "extern" shouldn't hurt So, add the void in fifos.c and proceed. |
|
|
|
在FIFOS.C文件更改中::函数定义中缺失的空洞类型导致(我认为编译器假设它不是int)。在更改之后,在XC8 1.43上编译OK。
以上来自于百度翻译 以下为原文 In fifos.c file change: fifo_init(struct fifo_t *f) { to: void fifo_init(struct fifo_t *f) { the missing void type in the function definition causes (I think) the compiler to assume it is int NOT void). Compiles OK on xc8 1.43 after this change. |
|
|
|
好了,修好了!Microchip必须让编译器做更好的检查。我的其他功能都有声明的类型,我错过了一个,猜我需要新的眼镜。我在我的大项目中测试,测试代码来自,问题也固定在那里!谢谢!戈登
以上来自于百度翻译 以下为原文 Ok, that fixed it! Microchip must have made the compiler do better checking. The rest of my functions all have the type declared, I missed that one, guess I need new glasses. I tested in my big project, that the test code was from and the problem is fixed there also! Thanks a lot! Gordon |
|
|
|
它会默认为int。我很惊讶编译器不会对此进行警告。
以上来自于百度翻译 以下为原文 It will default to int. I'm surprised the compiler doesn't warn on this. |
|
|
|
然而,同一函数中的这一行:
以上来自于百度翻译 以下为原文 However this line in the same function: f->data = 0; does produce the following: /fifos.c:12: warning: (373) implicit signed to unsigned conversion |
|
|
|
“修复它”:是的,它们明显改进了检查。重新警告:使ITF & Gt;data =(unChar char)0U;这将至少删除已签名/未签名的警告。最后,一些“截断”警告(UU-IT->U-char)可能会持续。
以上来自于百度翻译 以下为原文 Re "fixed it": yes - they obviously improved checking. Re the warning: make it f->data = (unsigned char)0u; This will at least remove the signed/unsigned warning. Eventually some "truncation" warning (u_int -> u_char) might persist. |
|
|
|
1.42版本的发行说明状态:冲突函数类型的草率检测(XC81538)。当定义在一个单独的模块中时,编译器没有检测到函数声明和函数定义之间的冲突,并且指定的返回类型有不同。f.
以上来自于百度翻译 以下为原文 The release notes state for the 1.42 release: Sloppy detection of conflicting function types (XC8-1538) The compiler did not detect conflicts between a function declaration and function definition when the definition was in a separate module and there was a difference in the return type specified. Jeff. |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1929 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3175 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2227 浏览 5 评论
736浏览 1评论
619浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
507浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
633浏览 0评论
530浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 08:27 , Processed in 1.785207 second(s), Total 98, Slave 82 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号