Connecting Tech Pros Worldwide Forums | Help | Site Map

Error C2065

jsl jsl is offline
Newbie
 
Join Date: May 2007
Posts: 7
#1: May 4 '07
i have converted my project from vc++ 6.0 to visual studio 2005, then the following code is giving me a problem
sample()
{
//int i; -------------(1)
for(int i=0; i<5;i++)-------------(2)
{
......
.....
}

i=20;----------(3)
}

The error i got at (3) is Error C2065: 'i' : undeclared identifier. If i remove the declaration of i at (2) and declared at (1), iam getting lot of warnings like warning C4996: 'fopen' was declared deprecated... how can i declare

Expert
 
Join Date: Feb 2007
Location: Bangalore
Posts: 182
#2: May 4 '07

re: Error C2065


Quote:

Originally Posted by jsl

i have converted my project from vc++ 6.0 to visual studio 2005, then the following code is giving me a problem
sample()
{
//int i; -------------(1)
for(int i=0; i<5;i++)-------------(2)
{
......
.....
}

i=20;----------(3)
}

The error i got at (3) is Error C2065: 'i' : undeclared identifier. If i remove the declaration of i at (2) and declared at (1), iam getting lot of warnings like warning C4996: 'fopen' was declared deprecated... how can i declare

The scope of i in your statement 2 is only inside for loop. You need to declare i according to 1.

Fopen is deprecated since we have much more secure version available. fopen_s. Since fopen_s is much more secure then fopen.

If you are confident enough about the security you can supress the warning.
:)
arunmib's Avatar
Member
 
Join Date: May 2007
Posts: 104
#3: May 4 '07

re: Error C2065


i think the following link might be of use to you in the near future...explains about all the compiler errors you get and why get with simple examples....

http://msdn2.microsoft.com/en-us/library/aa249862(VS.60).aspx
jsl jsl is offline
Newbie
 
Join Date: May 2007
Posts: 7
#4: May 4 '07

re: Error C2065


Quote:

Originally Posted by svlsr2000

The scope of i in your statement 2 is only inside for loop. You need to declare i according to 1.

Fopen is deprecated since we have much more secure version available. fopen_s. Since fopen_s is much more secure then fopen.

If you are confident enough about the security you can supress the warning.
:)


actually whwn this decations will come..
jsl jsl is offline
Newbie
 
Join Date: May 2007
Posts: 7
#5: May 4 '07

re: Error C2065


Quote:

Originally Posted by jsl

actually when this deprecations will come..

actually when this deprecations will come...
Reply