error: ‘for’ loop initial declarations are only allowed in C99 mode
2015-12-30 20:47
274 查看
比如写出下面这段程序:
for (int i = 0; i < n; ++i)
do_something();
然后用gcc编译,会报 ‘for’ loop initial declarations are only allowed in C99 mode的错误。
原因是在循环条件中声明变量的话,只在C99标准中支持,C90标准不支持。
所以改成:
int i;
for (i = 0; i < n; ++i)
do_something();
这样编译就可以通过了。
for (int i = 0; i < n; ++i)
do_something();
然后用gcc编译,会报 ‘for’ loop initial declarations are only allowed in C99 mode的错误。
原因是在循环条件中声明变量的话,只在C99标准中支持,C90标准不支持。
所以改成:
int i;
for (i = 0; i < n; ++i)
do_something();
这样编译就可以通过了。
相关文章推荐
- “Ceph浅析”系列之六Ceph与OpenStack
- IE下 c00ce56e 错误竟然是nginx 字符设置的问题
- Linux环境下安装和卸载软件的方法
- tomcat9下载编译到eclipse。
- 32位ubuntu14.04手动编译hadoop2.6.0
- 2.linux基础知识与技能
- linux命令之crontab 任务实时调度
- openGL中的混合
- CentOS6.5搭建LNMP
- CentOS6.5搭建LNMP
- Collectl: Linux 性能监控的全能冠军
- Linux 的档案权限与目录配置
- tomcat配置多个web的配置详解
- Linux系列软件源码安装之三-----Supervisor
- Linux环境下MySQL基础命令(3)----增、删、改、查语句
- OpenGL旋转立方体的实现
- tomcat ip地址访问项目 映射共享目录
- ubuntu环境下的用户添加 - 指定用户shell
- shell脚本学习(五)
- ubuntu opencv3 安装