您的位置:首页 > 移动开发

#268: declaration may not appear after executable statement in block 另类错误原因

2013-09-10 17:19 661 查看
Code_LPC1700\Driver\Uuart.c(958): warning: #550-D: variable "uiState" was set but never used

C:\Keil\ARM\INC\NXP\LPC17xx\LPC17xx.H(31): error: #268: declaration may not appear after executable statement in block

C:\Keil\ARM\RV31\INC\stdint.h(43): error: #268: declaration may not appear after executable statement in block

Code_LPC1700\Driver\Uuart.c(1104): warning: #177-D: variable "sendlen" was declared but never referenced

Code_LPC1700\Driver\Uuart.c(1104): warning: #177-D: variable "num" was declared but never referenced

Code_LPC1700\Driver\Uuart.c(1105): warning: #177-D: variable "ap" was declared but never referenced

C:\Keil\ARM\RV31\INC\stdint.h(43): error: #67: expected a "}"

C:\Keil\ARM\RV31\INC\stdint.h(51): error: #256: invalid redeclaration of type name "uint32_t" (declared at line 36 of ".\Code_LPC1700\UserAPP\includes.h")

C:\Keil\ARM\RV31\INC\core_cm3.h(156): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(156): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(157): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(157): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(158): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(158): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(159): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(159): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(160): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(160): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(162): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(162): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(163): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(163): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(164): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(164): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(165): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(165): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(166): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(166): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(167): error: #40: expected an identifier

C:\Keil\ARM\RV31\INC\core_cm3.h(167): error: #18: expected a ")"

C:\Keil\ARM\RV31\INC\core_cm3.h(1067): error: #134: expected a field name

C:\Keil\ARM\RV31\INC\core_cm3.h(1070): error: #134: expected a field name

C:\Keil\ARM\RV31\INC\core_cm3.h(1084): error: #134: expected a field name

C:\Keil\ARM\RV31\INC\core_cm3.h(1096): error: #20: identifier "IRQn_Type" is undefined

Target not created

以下错误:消耗了我10个小时,特止留印,备查

开始我一直在LPC17xx.H,stdint.h,core_cm3.h 三个文件中找

并发现凡是以 "typedef" 开头的地方都报错,以为找到问题了,就一直在查这个typedef

认为可能是程序的配置上有问题,由是就按能正常运行的文件配了N次,结果还时不行,

这时想到了把他们的工程文件 UCOSii_LPC1700.uvproj,互换一下试一下,结果还是一样

既然配置一样了,工程文件也一样了,都不行,那么源文件我交换试一下呢,然后依次交换源

文件夹,在交换到Driver文件夹时,出现了一个读入Uuart.c文件的提示,难道说之前的Uuart.c文件没有读入?

我打开原来的Driver文件夹,看到Uuart.c文件是在这个文件里的都嘛,由于我反复替换Uuart.c文件,发现

确实是Uuart.c文件引起的错误,于是打开Uuart.c文件来看,这才终于找到了问题的原因.

我都无力吐糟了,这是什么错误,提示错误在B文件,实际错误在A文件,而且这个A文件是什么时候改的啊,我晕,

在:Code_LPC1700\Driver\Uuart.c文件的这个函数中,

void Uart_Printf(char *fmt,...)

{

uint8 SemErr;

uint16 sendlen,num;

va_list ap;

OSSemPend(PORTsendsemcount,800, &SemErr);

#include <LPC17xx.H> //错误在这里,这个地方是什么时候被插入了一个引用啊!!!!,吐血啊

va_start(ap,fmt);

vsprintf(uart_string,fmt,ap);

sendlen=strlen(uart_string);

num=uartFifoStatus(UART0,TX_FIFO);

if((num>0) && (num<sendlen)) while(uartFifoStatus(UART0,TX_FIFO)<sendlen);

uartWrite(UART0, (uint8*)uart_string, sendlen, NULL);

while(uartFifoStatus(UART0,TX_FIFO)<sendlen);

va_end(ap);

//OSTimeDly(OS_TICKS_PER_SEC/200);

OSSemPost(PORTsendsemcount);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐