+ -
当前位置:首页 → 问答吧 → 想移植一些windows下的程序到linux下。如何搭建环境?

想移植一些windows下的程序到linux下。如何搭建环境?

时间:2011-10-26

来源:互联网

error: 'for' loop initial declarations are only allowed in C99 mode
note: use option -std=c99 or -std=gnu99 to compile your code

例如代码如下
代码:
for(int i = 0; i<5; i++)
{
   printf("%d\n",i);
}


怎么弄可以让make的时候不提示这个错误呢?习惯了在for的括号里面初始化变量了

作者: jun_   发布时间: 2011-10-26

use option -std=c99 or -std=gnu99 to compile your code

作者: JiangHui   发布时间: 2011-10-26

JiangHui 写道:
use option -std=c99 or -std=gnu99 to compile your code


Are there any other solutions? such as set up sth so that I don't need to type the "-std=c99" every time. Can I set the C99 as default?
BTW:Since the C99 is not the default so which is default?

作者: jun_   发布时间: 2011-10-26

JiangHui 写道:
use option -std=c99 or -std=gnu99 to compile your code


刚试了一下,提示这个耶...怎么办?

make oldman -std=c99
make:无效选项 -- =
make:无效选项 -- c
make:无效选项 -- 9
make:无效选项 -- 9
用法:make [选项] [目标] ...

作者: jun_   发布时间: 2011-10-26

你要用make就先写makefile啊,-std=c99是gcc的编译选项

作者: JiangHui   发布时间: 2011-10-26