Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

Why do I get "error: name lookup of `i' changed for new ISO `for' scoping" error compiling old C++ code with latest g++?



This is not strictly a migration problem but more an issue of hitting new ISO C++ rules that probably weren't around when the code you are migrating to Linux was originally written.

The latest ISO standard imposes new rules on the scope of variables used in for loops.  The cause for the compilation error is probably because you have some code that looks something like:

for (i=0; i < 10; i++) {
          .... code here .....
}

i = 0;

The problem is that under new scoping rules the local automatic variable i is limited to the for loop and cannot be accessed outside the loop.

 
 
  © Copyright 2005-2010 Linuxtopia. All Rights Reserved.