error: ‘for’ loop initial declarations are only allowed in C99 mode
2015-11-05 15:09
495 查看
比如写出下面这段程序:
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();
这样编译就可以通过了。
相关文章推荐
- 错误: 找不到或无法加载主类 org.apache.hadoop.hdfs.server.namenode.NameNode 问题解决
- OpenGL的功能与OSG中对应的功能
- nginx常用命令
- linux共享库找不到问题
- Linux FTP配置详解(自己重新整理)
- nginx 配置摘要
- 自定义 TopBar
- Android Camera架构浅析
- 29个你必须知道的linux命令
- Linux 挂载须知: mount 一些小问题 mount: no medium found on /dev/sr0
- linux shell if -a 到-z参数含义
- linux:预定义变量和read命令
- rsync错误捕获 shell捕获返回码
- LINUX下动态链接库的使用-dlopen dlsym dlclose dlerror
- 我的网站
- Linux命令常用大全
- Redhat Linux5.4/5.5/5.8/6.0/6.3 ISO镜像文件下载
- shell和Python调用企业微信服务号进行报警
- linux启动关闭tomcat
- Xshell配色方案说明