#268: declaration may not appear after executable statement in block
2018-01-05 14:33
2271 查看
使用MDK调试程序的时候,出现了以下错误:
#268: declaration may not appear after executable statement in block
错误原因
keil官网解释:Keil C compilers are based on ANSI C C90 standard, but are expanded with added language extensions, practical concessions to the architectural peculiarities of the microcontrollers, and other features that meet the needs of embedded systems programmers.
In C90, all variable declarations must happen before any executable statements in a function or other code block. The compiler error message mentions the line number of the offending line of code.
简单讲就是C90的原因
解决方法
C99 enables you to mix declarations and statements within compound statements, like in C++. Turn on C99 mode in the Keil IDE under Project → Options for Target → C/C++ tab, and check C99 Mode. Read more about the –c99 compiler switch here.即,将MDK里的C语言标准改为C99
相关文章推荐
- #268: declaration may not appear after executable statement in block 另类错误原因
- keil中变量声明问题及error: #268: declaration may not appear after executable statement in block
- stm32:error: #268: declaration may not appear after executable statement in block
- declaration may not appear after executable statement in block
- error: #268: declaration may not appear after executabl statement in block
- declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- KeilMDK 编译报错:error: #268: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- declaration may not appear after executable statement in block
- declaration may not appear after executable statement in block
- 【complier】error: #268: declaration may not appear after executable statement in block
- 使用Keil-STM32,cmsis_os.c 出现 error: #268: declaration may not appear after executable....
- 搞定error: #268: declaration may not appear after executable statement
- ARMCC: Error #268: declaration may not appear after executable state
- SQL Error:An aggregate may not appear in the set list of an UPDATE statement.
- mysqlAB复制报[Warning] Statement may not be safe to log in statement format
- SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.