Olivier Meplan wrote:
>
> Hi Rooters!
> I have a stupid problem...but I don't know how to solve it!
> In my code I write
> for (Int_t i=0 ; i< 10 ; i++)
> {
> ....
> }
> for (Int_t i=0 ; i< 10 ; i++)
> {
> ....
> }
>
> Thios work well with the DEC and Linux compilers but with CC of SUN
> there is this error message:
> Error: Multiple declaration for i.
> What can I do (except rewrite all the code!)
> Thanks a lot
> Olivier Meplan
Hi,
try putting to embed the for statements (and the loop body)
into braces:
{
for (Int_t i=0 ; i< 10 ; i++)
{
....
}
}
{
for (Int_t i=0 ; i< 10 ; i++)
{
....
}
}
You might also leave out the Int_t (in the parentheses of the
for statement) for the second and the following loops.
However, if you have another variable i outside the for
statements, it will be overwritten in the loops.
best regards,
André
--
------------------+----------------------------------
Andre Holzner | +41 22 76 76750
Bureau 32 2-C13 | Building 32
CERN | Office 2-C13
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET