傅令江的光影色彩世界
Error:‘for’ loop initial declarations are only allowed in C99 mode 的解决方案
2022-9-29 傅令江

今天编译一个老项目,然后就报错

Error:‘for’ loop initial declarations are only allowed in C99 mode 的解决方案

note: use option -std=c99 or -std=gnu99 to compile your code


原来是gcc的标准分c89和c99

修改源码中的报错代码就可以解决

报错的地方原来是这样


for ( int index = 0;index < handlers_length ;index++){


修改成这样就可以了


int index;
for(index = 0;index < handlers_length ;index++){


变量的类型提前申明就可以了,编译版本不兼容,对写代码的还是有一定的要求啊


发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容