Hi, taking the following code for example:
for (int i= 0; i < 10; i++)
{
int nValue= i;
}
for (i = 0; i < 6; i++)
{
int nValue2= i;
}
This code works well for visual C++ 6.0. But in the later version of visual C++, the compiler has emhanced for loop scope. So, this code can't compile by visual studio 2005. There are two ways to solve this problem. First, which I recommand, you may follow the Solution1,Solution2 or Solution3 method to change the code to :
for (int i= 0; i < 10; i++)
{
int nValue= i;
}
for (int i = 0; i < 6; i++)
{
int nValue2= i;
}
The second way is changing the visual studio project setting. Please find this item: "property pages"->"Configuration propertites"->"C/C++"->"Language"->"Force Conformance In For Loop Scope" then change its default value "Yes" to "No". After that try to build the original code. Good luck to you.