keil编译程序出现declaration may not appear after executable statement in block 错误 解决办法
/* Init System, peripheral clock and multi-function I/O */ SYS_Init(); /* Init UART0 for printf */ UART0_Init(); _GPIO_SET_PIN_MODE(P3, 6, GPIO_PMD_OUTPUT); int i,j; while(1) { P36 = 0; for(i=0;i<10;i++) CLK_SysTickDelay(100000); P36 = 1; for(j=0;j<10;j++) CLK_SysTickDelay(100000); }
编译就会出现declaration may not appear after executable statement in block,
在keil中定义的变量声明不允许出现在语句之后,所以把int i,j;这句放在最前面。