NXP

#268: declaration may not appear after executable

2019-07-12 12:10发布

Code_LPC1700DriverUuart.c(958): warning:  #550-D: variable "uiState" was set but never used
C:KeilARMINCNXPLPC17xxLPC17xx.H(31): error:  #268: declaration may not appear after executable statement in block
C:KeilARMRV31INCstdint.h(43): error:  #268: declaration may not appear after executable statement in block
Code_LPC1700DriverUuart.c(1104): warning:  #177-D: variable "sendlen" was declared but never referenced
Code_LPC1700DriverUuart.c(1104): warning:  #177-D: variable "num" was declared but never referenced
Code_LPC1700DriverUuart.c(1105): warning:  #177-D: variable "ap" was declared but never referenced
C:KeilARMRV31INCstdint.h(43): error:  #67: expected a "}"
C:KeilARMRV31INCstdint.h(51): error:  #256: invalid redeclaration of type name "uint32_t" (declared at line 36 of ".Code_LPC1700UserAPPincludes.h")
C:KeilARMRV31INCcore_cm3.h(156): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(156): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(157): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(157): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(158): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(158): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(159): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(159): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(160): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(160): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(162): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(162): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(163): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(163): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(164): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(164): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(165): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(165): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(166): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(166): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(167): error:  #40: expected an identifier
C:KeilARMRV31INCcore_cm3.h(167): error:  #18: expected a ")"
C:KeilARMRV31INCcore_cm3.h(1067): error:  #134: expected a field name
C:KeilARMRV31INCcore_cm3.h(1070): error:  #134: expected a field name
C:KeilARMRV31INCcore_cm3.h(1084): error:  #134: expected a field name
C:KeilARMRV31INCcore_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_LPC1700DriverUuart.c文件的这个函数中,
void Uart_Printf(char *fmt,...)
{
    uint8 SemErr;
  uint16 sendlen,num;    
    va_list ap;


OSSemPend(PORTsendsemcount,800, &SemErr); 
#include                                    //错误在这里,这个地方是什么时候被插入了一个引用啊!!!!,吐血啊
    va_start(ap,fmt);
    vsprintf(uart_string,fmt,ap);
sendlen=strlen(uart_string);
num=uartFifoStatus(UART0,TX_FIFO);
if((num>0) && (num
    uartWrite(UART0, (uint8*)uart_string, sendlen, NULL);
while(uartFifoStatus(UART0,TX_FIFO)
    va_end(ap);
//OSTimeDly(OS_TICKS_PER_SEC/200);
OSSemPost(PORTsendsemcount);
}