Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c++ compiler Error

Status
Not open for further replies.

boon21

Technical User
Dec 18, 2005
7
0
0
US
Hello
I have a cide that my friend wrote on unix.
When i compile it in windows XP I have a ompiler error c2374: edefinition; multiple initialization,
This erroris about is about this line of the code:
for (int pp=5; pp <= 11; pp++).
My compiler is microsoft visual c++.
Does anyone knows how to solve this?
Thanks
 
Difficult to know without more details. Some hints:

- The error doesn't need to be necessarily on that line
- Check that there's no other pp variable defined.

Cheers,
Dian
 
Hi
Thanks for your replay.
Which more details are required?
 
What's your VC++ version? VC++ 6.0 is not standard-compliant: it treats declarations in for() in function level, so it can't compile good standard code
Code:
for (int i = ...;...;...)
{
... loop #1 body ...
}
// Alas, i declared here in VC++ 6.0
for (int i = ...) // VC++ 6.0 says i redefinition...
... loop #2 body ...
 
Some routes around it - you normally have to do this when switching between compliant and non-compliant compilers. You will find that many of the older Unix compilers (eg Solaris 5.6) are also non compliant.

1) declare i outside the loop - this is the easier one but it leads to the habit of using i outside the loop.
2) Put the for loops in yet another pair of {} - looks messy but it is effectively what the standard compliant version is doing.
 
Give me please a name of a standard-compliant
 
Hi
First of all-thanks to you all for your help!!!
I downloaded the Visual C++ 2005 Express Edition , but now-When I try to run the code it says:
project is out of date: client - Debug HL2MP Win32
Can someone tell me how to solve this problem?
 
Hi
First of all-thanks to you all for your help!!!
I downloaded the Visual C++ 2005 Express Edition , but now-When I try to run the code it says:
project is out of date: client - Debug HL2MP Win32
Can someone tell me how to solve this problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top