Contents


On-line Guides
All Guides
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

How To Guides
General How To Guides
JavaScript How To
HTML How To
Problem Solutions

 

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-2008 Linuxtopia. All Rights Reserved.