I have never learn C, just c++ ... and this code where I am working on is written for Linux, and for other compilers than VS. That is why I got tones of errors, one of them I don't know how to handle them without broke the functionality (I cannot try what I modify, so I am working blind).
I suspect the issue is that enums are usually used to signify single values, i.e the flags field is either FILE_READONLY or FILE_SYSTEM, but not both. If you need to combine values then you should really use a set of #define statements.
Thank you Richard, that error has vanished, but I cannot try this code yet ... why do you say that this solution is not really correct ? The safe solution would be to overload |= operator, but I cannot do that into enum, right ?
why do you say that this solution is not really correct ?
Because, as I mentioned before, enums are used to indicate a set of possible values for an item. For example a class of type Car could contain an enum that indicates the manufacturer, such that the enum definition is:
AUDI = 1,
And you would never combine thos values in the car type variable.
So, in your case you should use #define statements, which the compiler will be happy with.
But this enum is not a part of any struct or class, is just defined into a header file, along with other several enum's ... and this enum has a lot of values, that is why I intend to avoid to translated as #define's ... I don't know what to do ...
But the issue is, as I keep repeating, that this is not the correct way to use enums. If you want to combine flag values then use #define, if you want to select one value from a set then use enum. That is the rule for C and C++, and that is why the compiler complains about your code.