简体   繁体   English

Eclipse中c99标准的问题

[英]issues with c99 standard in Eclipse

I'm trying to build a C project in Eclipe and I get this error: 我正在尝试在Eclipe中构建C项目,但出现此错误:

" 'for' loop initial declarations are only allowed in C99 mode " “'for'循环初始声明仅在C99模式下允许“

needless to say that I added -std=c99 in the project properties. 不用说,我在项目属性中添加了-std = c99。 it's the first time I get this problem. 这是我第一次遇到这个问题。 any ideas what's wrong? 有什么想法吗?

I'm assuming your code looks something like this: 我假设您的代码看起来像这样:

for(int a = 0 ; a < 42 ; a++)

In early versions of C you can't assign local variables inside for loops. 在早期版本的C中,您不能在for循环内分配局部变量。 Change it to: 更改为:

int a = 0;
//some code
for(a = 0 ; a < 42 ; a++)
{
    //your code
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM