Re: C2664 compilation error by using typedef enum in a idl file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Torsten,

thank you for your suggestioin. I changed the code. So now it looks
like: [v1_enum] enum _units_t

You should avoid identifiers starting with an underscore as those
are reserved for the compiler vendors. You are asking for a naming
collision here.

{
millimeters = 0,
inches,
points
};

Unfortunatly the compile error didn't changed. I skiped the [v1_enum]
as well, just in case, but the error was still the same.

Strange, I use them quite often. With the v1_enum that ensures that a 32 bit
data type is used.
Did you put the enum outside any other block, even outside the library block?
You started to use it inside of an interface. I would put it outside of any other
block. If you need it included in the library block just use a forward declaration
in that block:

library whatEverLib
{
enum units_t;
}

Additionally I found several examples like
typedef [v1_enum] enum tagUI_MESSAGE_TYPE
{
UI_MESSAGE_ERROR = 0x00000000,
UI_MESSAGE_WARNING = 0x00000001,
UI_MESSAGE_UNKNOWN = 0x00000002,
} UI_MESSAGE_TYPE;
(see http://support.microsoft.com/kb/907229/de) for instance.

Looks like that C style usage is not your problem

Is it possible that it is a bug? I am using Visual Studio 2005 Version
8.0.50727.762 (SP 050727-7600). I could not find anything on the
internet about that.

I switched to VC9 a while ago but hat no problems with VC8 on my
enum types. So I guess it is not a bug or a rare condition you run into

You could try to create a minimal sample by creating a simple ATL
project with one ATL simple object and then add your enum to that
idl and see how it goes.

--
SvenC

.



Relevant Pages

  • Re: enum type declaration error
    ... there is C equivalent "enum" type existed in JAVA. ... initial experiment is giving compile error as below. ... public enum returnStatus ...
    (comp.lang.java.programmer)
  • Re: enum type declaration error
    ... there is C equivalent "enum" type existed in JAVA. ... initial experiment is giving compile error as below. ... public enum returnStatus ...
    (comp.lang.java.programmer)
  • Re: odl or idl?
    ... add the enum to the odl file and change the interface prototypes to ... declarations _outside_ the library block. ... Your ODL file, I bet, defines everything inside a library block. ...
    (microsoft.public.vc.atl)
  • Re: Enums in ATL Server
    ... If I use the enum as a parameter to one of the methods on the server, ... Are you sure the enum _is_ referenced in the library block? ... indirectly reference it and force its inclusion into the type library, ... You can pass the integer value of the enum constant as a variant of ...
    (microsoft.public.vc.atl)
  • enum handling change in VS 2005
    ... I've installed the VS 2005 Beta 1 and was trying to build our current ... I get a compile error when enum value is specified with ... class CMyEnumClass ... enum MyMode ...
    (microsoft.public.dotnet.languages.vc)