设置codeblocks为c99标准

      用codeblocks编写如下程序:

    for(int i=1; i<= n; i++)
    {
        p=p*(1+r);
    }

时报如下错误:

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

原来codeblocks的gcc默认不是以c99编译c文件,需要设置一下,过程如下:

 

1. 在Settings菜单栏下找到Compiler…菜单项,如下图:

 

 

2.在Global compiler setting中选择Compiler settings选项卡,在Other options中填入:-std=c99,如下图:


 

 

 

 

posted @ 2014-03-16 21:01  龙格泽月  阅读(1743)  评论(0)    收藏  举报