[ODE] OPCODE messing with variable scope? (MSVC6)
Gary R. Van Sickle
g.r.vansickle at worldnet.att.net
Wed Sep 24 18:40:07 MST 2003
> Hi all,
> OPCODE seems to be doing something odd to how the MSVC6 compiler
> interprets variable scope.
>
> If I have something like:
>
> #include <Opcode.h>
>
> int a = 10;
> for (int i=0; i<a; i++)
> {
> // do something
> }
> for (i=0; i<a; i++)
> {
> // do something else
> }
>
> I get "error C2065: 'i' : undeclared identifier" from MSVC6 at the start
> of the second loop, as if the first declaration of i (at the start of
> the first loop) gives it scope that is internal to the first loop only.
> If I leave out #include "Opcode.h" this does not happen.
>
> Could something in OPCODE's headers be changing a compiler setting?
I don't know, but what you're trying to do isn't kosher C or C++. Put the "int
i=0;" outside both loops and everything will work fine.
--
Gary R. Van Sickle
Brewer. Patriot.
More information about the ODE
mailing list