codeblocks的c99设置

来源:互联网 发布:智云软件开发 编辑:程序博客网 时间:2024/05/21 21:42

使用codeblocks编译代码时报出

error: 'for' loop initial declarations are only allowed in C99 mode

note: use option -std=c99 or -std=gnu99 to compile your code错误

因为在gcc中直接在for循环中初始化了增量:

for(int i = 0; i < n; i++)

即不允许在for循环里定义变量i

GCC编译器在默认情况下不支持C99而是C94。

设置方法:settings -> compiler -> other options  内加上  -st=c99

0 0