'for' loop initial declarations are only allo
linux系统下的c编程与windows有所不同,如果你在用gcc编译代码的时候提示‘for’ loop initial declarations are only allowed in C99 mode,可能就是因为你在loop循环比如for中使用未预先定义的变量,比如:
for(int i=0;i<10;i++)
{
}
这种写法在vc里是没有错的,而子gcc就会提示错误,要求遵守c89标准,c89标准是不支持上述写法的。如果你非要这么写可以这样编译,使用c99标准:
gcc helo.c -std=c99 -o hello
当然,你也可以先定义i变量。
int i;
for(i=0;i<10;i++)
{
}
这样再编译就不会再提示‘for’ loop initial declarations are only allowed in C99 mode这样的错误了
'for' loop initial declarations are only allo的更多相关文章
- error: ‘for’ loop initial declarations are only allowed in C99 mode
比如写出下面这段程序: for (int i = 0; i < n; ++i) do_something(); 然后用gcc编译,会报 ‘for’ loop initial declaratio ...
- ‘for’ loop initial declarations are only allowed in C99 mode
#include <stdio.h>int main(){ for(int i=0;i<10;i++){ printf("\n%d",i); } return 0 ...
- error: ‘for’ loop initial declarations are only allowed in
使用gcc,出现如下错误: thread_join.c:7:5: error: 'for' loop initial declarations are only allowed in C99 mode ...
- error: 'for' loop initial declarations are only allowed in C99 mode
error: 'for' loop initial declarations are only allowed in C99 mode 出现错误: error: 'for' loop initia ...
- error: 'for' loop initial declarations are only allowed in C99 mode
error: 'for' loop initial declarations are only allowed in C99 mode 使用gcc编译代码是报出 error: 'for' loop i ...
- 【异常】‘for’ loop initial declarations are only allowed in C99 mode
1 Python版本导致的异常 /root/Python-3.5.7/Modules/_pickle.c: In function ‘PyMemoTable_Copy’: /root/Python-3 ...
- Win下GCC报错 error: ‘for’ loop initial declarations are only allowed in C99 mode
##报错## 用GCC编译for循环会出现以下错误 error: 'for' loop initial declarations are only allowed in C99 mode 如图所示: ...
- for’ loop initial declarations are only allowed in C99 mode
今天做南邮编程在线的编程题,编程首先计算Fibonacci数列1,1,2,3,5,8,13,21,......的前n项(n不超过40)存入一维整型数组f中,再按%12d的格式输出每项的值,每6项换一行 ...
- [Error] 'for' loop initial declarations are only allowed in C99 or C11 mode
#include <stdio.h> #include <stdlib.h> #define LIST_INIT_SIZE 100 //线性表存储空间的初始分配量 #defin ...
随机推荐
- 用php命令执行php脚本报错,在浏览器里执行却正常。
写了一个Php脚本,里面用到了PDO连接数据库,但是所有的库都已经安装,在浏览器里执行完全正常,但是写到批处理文件里用php命令去执行的时候却报错找不到驱动,很奇怪. 经查找得知原来php命令与浏览器 ...
- 转:Numpy教程
因为用到theano写函数的时候饱受数据结构困扰 于是上网找了一篇numpy教程(theano的数据类型是基于numpy的) 原文排版更好,阅读体验更佳: http://phddreamer.blog ...
- Deep Learning 阅读笔记:Convolutional Auto-Encoders 卷积神经网络的自编码表达
需要搭建一个比较复杂的CNN网络,希望通过预训练来提高CNN的表现. 上网找了一下,关于CAE(Convolutional Auto-Encoders)的文章还真是少,勉强只能找到一篇瑞士的文章. S ...
- 控件的WndProc WindowProc
SubClassWndProc This example shows how to use the WndProc method and the WindowProc property to subc ...
- 简单例子让你很好的理解:协议与委托 (Protocol and Delegate)
1 协议: 协议,类似于Java或C#语言中的接口,它限制了实现类必须拥有哪些方法. 它是对对象行为的定义,也是对功能的规范. 示例: 1 2 3 4 5 6 7 8 9 // GoodChild.h ...
- android学习-Eclipse中修改Android项目图标
参考原文:http://blog.csdn.net/wpwbb510582246/article/details/52556753 方法一:替换res文件夹下的ic_launcher-web.png图 ...
- 《Head First 设计模式》观后感——专业并不一定是深奥和枯燥
<Head First 设计模式>观后感——专业并不一定是深奥和枯燥 说起设计模式,我想做程序的朋友都不会感到陌生,这就像是软件里的缩写一样,可以快速的表达一系列的意思. 但是纵观市面上的 ...
- 前端 webpack
前端 webpack http://www.cnblogs.com/lvdabao/
- 编码总结,以及对BOM的理解
一.前言 在跨平台.跨操作系统或者跨区域之间,经常会涉及到编码的问题,因为前段时间在项目中,遇到了因为编码而产生乱码的问题,以前对编码也是一知半解,所以决定对编码有一个更为深入的了解,因此才有了这篇自 ...
- 104. Maximum Depth of Binary Tree (Tree; DFS)
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...