Nevyn <> wrote in message
news

...
> Hi, i am developing a xplatform open source project using qt,
> and it did not compile out of the box on windows (VC 6.0 no SP) cos of
> some C++ 'errors'
>
> e.g.
>
> file.h
> class foo
> {
> .
> .
> .
> void method(int=0);
> }
>
> file.cpp
> foo::method(int a=0)
> {
> .
> .
> .
> }
>
> VC complained about re-definition of default parameter,
If you write a member function implementation outside
the class body, you should only define the default parameter
in the prototype.
> while g++ (2.95.3)
> compiled w/ even warnings (-Wall switch was on)
>
> VC also complained for this
>
> {
> int i=0;
> .
> .
> .
> for( int i=0;i<100;i++)
> .
> .
> .
> }
>
This is a well-known VC++ bug.
> again, re-definition of variable i
>
> what should i do to avoid these problems? (i am total newbie at VC)
Use a different name for one of the 'i's,
or create a 'dummy' scope:
int i = 0;
/* etc */
{
for(int i; /* etc */)
/* etc */
}
-Mike