tune2fs
tune2fs

Reputation: 7705

Visual studio compiler errors at enum

I have the following code which compiles without errors under Linux and Mac OS X. I now want to compile the code with Windows, but I get a lot of errors in the following code segment:

...
enum Type   
    {
        UPDATE = 0, DELETE = 1
    };
...

The error messages are these:

1>Request.hpp(48) : error C2143: syntax error : missing '}' before '('
1>Request.hpp(48) : error C2059: syntax error : '<L_TYPE_raw>'
1>Request.hpp(49) : error C2143: syntax error : missing ';' before '}'
1>Request.hpp(49) : error C2238: unexpected token(s) preceding ';'

What did I wrong, I am really confused, as this compiles without errors under Linux. What can cause this errors?

Upvotes: 1

Views: 6829

Answers (2)

tune2fs
tune2fs

Reputation: 7705

The solution is quite easy, but one need to find out that DELETE is a Macro defined in the windows header.

I now added #undef DELETE and it works fine.

Upvotes: 6

Polynomial
Polynomial

Reputation: 28316

Type is an existing class. You need to change the name or specify that it's a literal.

You could try enum @Type to specify a literal, though you may need to prefix it with @ elsewhere.

Upvotes: 0

Related Questions