Home All Groups Group Topic Archive Search About

Re: Why Compiler Const Error when no Compiler Const exists

Author
16 May 2005 10:27 AM
thejamie
It may be the enumerated constants.   I moved some around and made one
particular set Public since I use it in many places throughout the program. 
When I make it a public rather than a private enumerator set, the error
returns.

Example:
Public Enum MyEnum
    eNone
    eOne
End Enum

In another module
Public Enum MyOtherEnum
    eNone
    eSomethingElse
End Enum



--
Regards,
Jamie


Show quoteHide quote
"MikeD" wrote:

>
> "thejamie" <theja***@discussions.microsoft.com> wrote in message
> news:EF318380-9038-4737-8086-072EFE43BCD3@microsoft.com...
> > Bob,
> >
> > Version VB6 SP6.
> >
> > Error is straightforward:
> > Modal header is "Microsoft Visual Basic"
> >
> > Message is "DUPLICATE DEFINITION"
> >
> > the message provides an OK and HELP option.
> >
> > I click OK and tried to open the program again - got the same message.
> This
> > happened after a compile.
> >
>
> You most likely have 2 procedures of the same name and within the same
> scope.  Since VB can't determine which one you intended to call, it raises a
> duplicate definition error.  Search your project for the procedure and limit
> the scope of one of the procedures, or if the procedures are actually
> identical, eliminate of them.
>
> Mike
>
>
>

Author
16 May 2005 5:00 PM
Michael D. Ober
The VB6 compiler can't tell the two eNone enumerations apart.  This is a
design bug in the compiler.  The workaround is to prefix all enumeration
values with a unique (to the enum statement) prefix.

Mike Ober.

Show quoteHide quote
"thejamie" <theja***@discussions.microsoft.com> wrote in message
news:9CCDD42F-27CC-48AA-8A8D-F3CAC148169B@microsoft.com...
> It may be the enumerated constants.   I moved some around and made one
> particular set Public since I use it in many places throughout the
program.
> When I make it a public rather than a private enumerator set, the error
> returns.
>
> Example:
> Public Enum MyEnum
>     eNone
>     eOne
> End Enum
>
> In another module
> Public Enum MyOtherEnum
>     eNone
>     eSomethingElse
> End Enum
>
>
>
> --
> Regards,
> Jamie
>
>
> "MikeD" wrote:
>
> >
> > "thejamie" <theja***@discussions.microsoft.com> wrote in message
> > news:EF318380-9038-4737-8086-072EFE43BCD3@microsoft.com...
> > > Bob,
> > >
> > > Version VB6 SP6.
> > >
> > > Error is straightforward:
> > > Modal header is "Microsoft Visual Basic"
> > >
> > > Message is "DUPLICATE DEFINITION"
> > >
> > > the message provides an OK and HELP option.
> > >
> > > I click OK and tried to open the program again - got the same message.
> > This
> > > happened after a compile.
> > >
> >
> > You most likely have 2 procedures of the same name and within the same
> > scope.  Since VB can't determine which one you intended to call, it
raises a
> > duplicate definition error.  Search your project for the procedure and
limit
> > the scope of one of the procedures, or if the procedures are actually
> > identical, eliminate of them.
> >
> > Mike
> >
> >
> >
>
Author
16 May 2005 6:15 PM
MikeD
"Michael D. Ober" <m***@.wakeassoc..com> wrote in message
news:utUa%23ijWFHA.3540@TK2MSFTNGP15.phx.gbl...
> The VB6 compiler can't tell the two eNone enumerations apart.  This is a
> design bug in the compiler.  The workaround is to prefix all enumeration
> values with a unique (to the enum statement) prefix.


Why do you say it's a bug?

--
Mike
Microsoft MVP Visual Basic
Author
17 May 2005 5:10 AM
Michael D. Ober
Because the outer enum types are different.  There is enough syntactical
information in the source to unambiguously distinguish between the two uses
of eNone.  This is a design bug in the VB 6 parser, one that it shares with
many older C compilers, including MS VC++ 6, as well.

If the outer two enum types were the same, then you have a situation where
you have a duplicate definition - the compiler cannot distinguish between
them.

Mike Ober.

Show quoteHide quote
"MikeD" <nob***@nowhere.edu> wrote in message
news:Oz$fxMkWFHA.2740@TK2MSFTNGP14.phx.gbl...
>
>
> "Michael D. Ober" <m***@.wakeassoc..com> wrote in message
> news:utUa%23ijWFHA.3540@TK2MSFTNGP15.phx.gbl...
> > The VB6 compiler can't tell the two eNone enumerations apart.  This is a
> > design bug in the compiler.  The workaround is to prefix all enumeration
> > values with a unique (to the enum statement) prefix.
>
>
> Why do you say it's a bug?
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>
>
>
Author
17 May 2005 6:40 AM
Jim Carlock
Like in www.freepascal.org where they offer a seperate namespace for each
unit ? Just a different way of doing things, like using a fingerprint to open
a door rather than a keycard rather than a metal key ? There's always a way
to get around opening doors, you can use a metal pick for metal latch locks,
a magnetic pick for magnetic key card locks, and you can get the fingerprint
by having the person touch a common object, dusting, raising the imprint and
then making a duplicate print (or perhaps the George W. Bush manner) ?

--
Jim Carlock
Please post replies to newsgroup.

"Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote:
Because the outer enum types are different.  There is enough syntactical
information in the source to unambiguously distinguish between the two uses
of eNone.  This is a design bug in the VB 6 parser, one that it shares with
many older C compilers, including MS VC++ 6, as well.

If the outer two enum types were the same, then you have a situation where
you have a duplicate definition - the compiler cannot distinguish between
them.

Mike Ober.

Show quoteHide quote
"MikeD" <nob***@nowhere.edu> wrote:
>
>
> "Michael D. Ober" <m***@.wakeassoc..com> wrote:
> > The VB6 compiler can't tell the two eNone enumerations apart.  This is a
> > design bug in the compiler.  The workaround is to prefix all enumeration
> > values with a unique (to the enum statement) prefix.
>
> Why do you say it's a bug?
>
> --
> Mike
> Microsoft MVP Visual Basic