[Error] name lookup of 'i' changed for ISO 'for' scoping [-fpermissive]
时间: 2024-05-02 14:22:16 浏览: 16
This error message typically occurs when using a C++ compiler that enforces the ISO standard for variable scoping. In older versions of C++, variables declared inside a for loop were automatically scoped to that loop, but in the ISO standard, they are not.
To fix this error, you can declare the variable before the for loop or use a newer version of the compiler that does not enforce the ISO standard.
For example, instead of:
```
for (int i = 0; i < 10; i++) {
// do something with i
}
```
You could declare the variable before the loop:
```
int i;
for (i = 0; i < 10; i++) {
// do something with i
}
```
Or you could use a newer version of the compiler that does not enforce the ISO standard.
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)