当前位置:网站首页>error: ‘for‘ loop initial declarations are only allowed in C99 mode
error: ‘for‘ loop initial declarations are only allowed in C99 mode
2022-07-21 00:15:00 【Ink mark v. breeze】
The phenomenon
In use today gcc Compile the code and report :
error: 'for' loop initial declarations are only allowed in C99 mode
note: use option -std=c99 or -std=gnu99 to compile your code
reason
Compilation error , This is because in the gcc Directly in for Increment... Is initialized in the loop :
for(int i=0; i<len; i++)
{
}
The first method
This grammar is in gcc Is wrong , You must first define i Variable :
int i;
for(i=0;i<len;i++)
{
}
This is because gcc be based on c89 standard , If you change into c99 The standard can be in for Define within the loop i The variable .
The second solution
It's in writable makefile When compiling instructions , take gcc for.c -o for.out
Change it to gcc -std=c99 for.c -o for.out
边栏推荐
- 1235. 规划兼职工作 动态规划
- App 应用测试方法以及测试思路……
- 字節一面掛了,面試官問DDD,我卻不知道
- 什么是复制冲突
- Component architecture project construction - gradle unified, dependent management and configuration
- 【Try to Hack】sql注入 Less7 (into outfile和布尔盲注)
- 使用binlog备份恢复myqsl数据
- MySQL 5.7 is about to stop and only maintain. It's time to learn a wave of MySQL 8
- [postman] use tests to set environment variables
- Golang - restful framework go restful
猜你喜欢
【Try to Hack】sql注入 Less7 (into outfile和布尔盲注)
不就是个TCC分布式事务,有那么难吗?
Lua代码添加注释规则
测试/开发程序员小张相亲记......
数据中心,决定城市未来发展动力的新型基础建设
Devil cold rice | 103 devil sees the economy; Uncompleted residential flats, rental rider, Zhouyi and reservoir quality men
Data center, a new type of infrastructure that determines the driving force of the city's future development
Maintainability of data intensive application of reading notes
If paging by frame fails - solution
Without available task slots, what will happen to Flink's new tasks?
随机推荐
黑灰产眼中的NFT:平台嗷嗷待宰,用户送钱上门
flv. JS load video stream
字节一面挂了,面试官问DDD,我却不知道
使用binlog备份恢复myqsl数据
科研丨Overleaf打开LaTeX编译报错:PDF渲染错误【已解决】
2022.7.19-----leetcode.731
Transform streams into data products
Is it safe to choose online stock account opening in Hangzhou and Wuhan?
《PyTorch深度学习实践》学习笔记:循环神经网络(基础篇)
Devil cold rice | 103 devil sees the economy; Uncompleted residential flats, rental rider, Zhouyi and reservoir quality men
惊!储户近200万存款被“刷脸”盗走,快看看你的银行卡有这三类风险吗?
Helm 介绍
Centos8 install MySQL
Redis upgrade on Linux
Use of Matplotlib Library
Revit (22) familyinstance common API encapsulation
微信小程序开发学习4(视图与逻辑)
awk 统计平均 最大 最小值
方法
CDH cluster construction (6.3)