enumeration giving weird error

Hi
I am facing a weird problem with my code. I am loading a .bmp file with a bmp loader but it gives me weird error. To make matters worse it works absolutely fine on other machine which have the same version of the Visual Studio I am using.

I have attached the BMPLoader.cpp and BMPLoader.h files if you want to try,

To be specific these are the lines where the error is coming.

enum CompressionType
{
BI_RGB,
BI_RLE8,
BI_RLE4
};

static CompressionType compression;

The error is
BMPLoader.cpp(41): error C2143: syntax error : missing '}' before 'constant'
BMPLoader.cpp(44): error C2143: syntax error : missing ';' before '}'
BMPLoader.cpp(44): error C2059: syntax error : '}'

Please help

Utk
[849 byte] By [utkseth] at [2007-11-20 11:38:45]
# 1 Re: enumeration giving weird error
Your compiler doesn't know what BI_RGB is. I am guessing that you are missing wingdi.h from your include path somewhere. Make sure you are including windows.h if you want to use these constants.
BJW
sockman at 2007-11-9 1:26:03 >
# 2 Re: enumeration giving weird error
have you tried a clean and rebuild (if it seems to compile on the other sytem)
Or comment out some stuff to make the error go away, and then gradually uncomment untill you find the exact source of the problem?
ejac at 2007-11-9 1:27:03 >
# 3 Re: enumeration giving weird error
Sorry. Didn't read the first post very well. I missed that it was compiling on a different machine. However, the diagnosis is still the same. Your compiler definitely does not have a symbol defined for the contents of your enum. Do as Ejac suggested.
sockman at 2007-11-9 1:28:05 >
# 4 Re: enumeration giving weird error
However, the diagnosis is still the same. Your compiler definitely does not have a symbol defined for the contents of your enum.The compiler does not need to have these symbols defined. The above code declares BI_RGB, BI_RLE8 and BI_RLE4 to be enum values.

The only reason I can see for this error is that BI_RGB are already declared in some header file. Try to use different names (e.g. prefix with en). You can also write it like enum CompressionType
{
enBI_RGB = BI_RGB,
enBI_RLE8 = BI_RLE8,
enBI_RLE4 = BI_RLE4
};But maybe you want to skip declaring this enum type altogether and just check as what the constants are declared.
treuss at 2007-11-9 1:29:00 >
# 5 Re: enumeration giving weird error
Hi treuss

The solution you gave worked. I declared enumeration as you told and now the code is working. Could you tell me please why was that happening and how this solution you provided started working ?

Thanks a lot

Utk
utkseth at 2007-11-9 1:30:04 >
# 6 Re: enumeration giving weird error
The solution you gave worked. I declared enumeration as you told and now the code is working. Could you tell me please why was that happening and how this solution you provided started working ?I can't tell exactly because I don't have openGL headers running around. But somewhere in the headers you are including, BI_RGB et.al are declared, probably something along the lines#define BI_RGB 42 If that is the case, your enum code will be translated by the preprocessor to something like enum CompressionType
{
42,
43,
44
};which does not really make sense.
treuss at 2007-11-9 1:31:06 >
# 7 Re: enumeration giving weird error
Cudnt figure out where else the variable was declared. Still, really appreciate ur help
utkseth at 2007-11-9 1:31:59 >