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
for (int i = 0; i < 2; ++i)
^
thread_join.c:7:5: note: use option -std=c99 or -std=gnu99 to compile your code
出错的代码如下:
这是因为使用gcc时,直接在for循环中初始化落变量,这是因为gcc基于c89标准,换成C99标准就可以在for循环内定义i变量了。
gcc thread_join.c -std=c99 -lpthread -o thread_join
error: ‘for’ loop initial declarations are only allowed in的更多相关文章
- 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 ...
- 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 如图所示: ...
- 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 ...
- [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 ...
- 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 ...
- ‘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 ...
- 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项换一行 ...
- 'for' loop initial declarations are only allo
linux系统下的c编程与windows有所不同,如果你在用gcc编译代码的时候提示‘for’ loop initial declarations are only allowed in C99 mo ...
随机推荐
- iOS:UI系列之UIScrollview和UIPagecontrol
转眼间,又是一天,就这样忙忙碌碌的一天一天的过着, 不过还好,不是浑浑噩噩的,也算是小有所成,劳有所获吧,嘿嘿! 好了,到了总结的时间啦, 下面就为大家简单讲解下我今天学习的内容吧,希望对各位都有所帮 ...
- SQL语句中的DQL、DML、DCL、DDL、CCL、TPL
结构化查询语言(Structured Query Language)简称SQL,是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询.更新和管理关系数据库系统:同时也是数据库 ...
- django防止表单数据重复提交
思路: 在Asp.net中存在Page.IsPostback的方法,所以对django中表单提交数据的重复提交的数据采用相似方法实现,即在页面第一次访问时,即访问方法为GET方法在view中 ...
- SELECT TOP column FROM table [ORDER BY column [DESC]]
如果想返问表中行的子集,仅需要返回特定数量的记录,而不管符合条件的行有多少.要返回排在前面的值,可以有两个选择:指定固定数量的行,或者指定总行数的百分比.SQL Server不对这些数据做任何分析,共 ...
- shell脚本例子
#!/bin/sh str="####" echo $1 | grep $str 1>/dev/null if [ `echo $?` -eq 0 ] then ec ...
- HttpClient中异步方法的同步调用
在System.Net.Http中,提供了使用Http与远程服务器通讯的httpClient,但是里面都是异步方法,有时候我们并不需要使用异步操作.这个时候可以使用如下的方式来进行同步调用. clas ...
- CSS3弹性盒模型布局模块介绍
来源:Robert’s talk原文:http://robertnyman.com/2010/12/02/css3-flexible-box-layout-module-aka-flex-box-in ...
- ASP.NET Ajax
代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- ...
- mysql 性能分析套件
#!/usr/local/python3./bin/python3. #!coding:utf- #################################### #目地:用于诊断mysql性 ...
- SD/MMC卡初始化及读写流程
二.MMC/SD卡的模型和工作原理 PIN脚.SD卡总线.SD卡结构.SD卡寄存器.上电过程 SD卡寄存器: OCR:操作电压寄存器: 只读,32位 第31位: 表示卡上电的状态位 CID: 卡 ...