error: 'for' loop initial declarations are only allowed in C99 mode
2016-06-28 17:00
459 查看
使用gcc编译代码是报出
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循环中初始化了增量:
这语法在gcc中是错误的,必须先先定义i变量:
这是因为gcc基于c89标准,换成C99标准就可以在for循环内定义i变量了:
gcc src.c -std=c99 -o src
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<10; i++) { }
这语法在gcc中是错误的,必须先先定义i变量:
int i; for(i=0; i<10; i++) {}
这是因为gcc基于c89标准,换成C99标准就可以在for循环内定义i变量了:
gcc src.c -std=c99 -o src
相关文章推荐
- location nginx
- Linux下源代码阅读工具
- nginx root && alias 文件路径配置
- Shell运算符:算数、关系、布尔、字符串运算符.
- selinux默认值修改
- linux shell set
- 查看LINUX发行商版本与LINUX内核版本
- linux curl 命令详解
- Linux的死锁检测
- NGINX 快速入门
- sqoop&Hive实例
- MAC下date -r 的使用
- Camera driver&V4L2驱动架构介绍
- windows 安全设置
- Linux grep命令用法以及正则表达式
- (转) Linux调优方案,sysctl.conf的设置
- SQL Server 启用 xp_cmdshell 与bcp 使用
- FastDFS安装与nginx反向代理配置
- 研读《高可用多节点集群技术的研究和实现》-----集群系统的软件体系结构
- linux超级终端minicom的使用方法