In C++ you cannot use the ENUM values starting at ERROR?

There's this enum:

enum class MonoIOError {
 ERROR_SUCCESS = 0,
 ERROR_FILE_NOT_FOUND = 2,
 ERROR_PATH_NOT_FOUND = 3,
 ERROR_TOO_MANY_OPEN_FILES = 4,
 ERROR_ACCESS_DENIED = 5,
 ERROR_INVALID_HANDLE = 6,
 ERROR_INVALID_DRIVE = 15,
 ERROR_NOT_SAME_DEVICE = 17,
 ERROR_NO_MORE_FILES = 18,
 ERROR_NOT_READY = 21,
 ERROR_WRITE_FAULT = 29,
 ERROR_READ_FAULT = 30,
 ERROR_GEN_FAILURE = 31,
 ERROR_SHARING_VIOLATION = 32,
 ERROR_LOCK_VIOLATION = 33,
 ERROR_HANDLE_DISK_FULL = 39,
 ERROR_FILE_EXISTS = 80,
 ERROR_CANNOT_MAKE = 82,
 ERROR_INVALID_PARAMETER = 87,
 ERROR_BROKEN_PIPE = 109,
 ERROR_INVALID_NAME = 123,
 ERROR_DIR_NOT_EMPTY = 145,
 ERROR_ALREADY_EXISTS = 183,
 ERROR_FILENAME_EXCED_RANGE = 206,
 ERROR_DIRECTORY = 267,
 ERROR_ENCRYPTION_FAILED = 6000
};


Absolutely every line I get the error:
E0040 requires the ID

Something similar happens also here:

enum class TOKEN {
 NONE = 0,
 CURLY_OPEN = 1,
 CURLY_CLOSE = 2,
 SQUARED_OPEN = 3,
 SQUARED_CLOSE = 4,
 COLON = 5,
 COMMA = 6,
 STRING = 7,
 NUMBER = 8,
 TRUE = 9,
 FALSE = 10,
 NULL = 11
};


But only with the last three values. Can I bypass this error?

Clarify that all wrapped enum in a separate namespace
April 3rd 20 at 17:31
1 answer
April 3rd 20 at 17:33
Solution
#define ERROR_SUCCESS 0
from this no namespaces do not help.
And you seem to have somewhere to connect libraries with similar declarations.
You are right, at least `ERROR` found in `wingdi.h` - Abigale_Kuphal53 commented on April 3rd 20 at 17:36
That is, the decision in fact - to call the value otherwise? - Abigale_Kuphal53 commented on April 3rd 20 at 17:39
@Abigale_Kuphal53, it is better to have the habit of any constants, which at least theoretically may overlap with the library, start with a unique prefix. - Marco.Prosacco commented on April 3rd 20 at 17:42
@Marco.Prosacco, I would have done, but those values from the metadata are generated, and as a result will have to write a crutch that they changed the name a bit - Abigale_Kuphal53 commented on April 3rd 20 at 17:45
@Abigale_Kuphal53if you have something created on the fly - chances are, you shouldn't have associated with enum. If this is not the bottleneck - work with strings and do not take themselves or the computer in the head with extreme savings. - Marco.Prosacco commented on April 3rd 20 at 17:48

Find more questions by tags C++