I got a bunch of errors when I was compiling my C++ program.
In file included from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/windows.h:71,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/rpc.h:16,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/wtypesbase.h:7,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/shlobj.h:9,
from modules/batch-verification/hashdata.h:6,
from modules/batch-verification/batverify.h:7,
from modules/batch-verification/batverifyresult.cpp:4:
modules/batch-verification/hashdata.h:13:55: error: expected identifier before numeric constant
enum class EHashCalculateResult{UNPROCESSED, CORRECT, ERROR, FILE_NOT_EXIST};
^~~~~
modules/batch-verification/hashdata.h:13:55: error: expected '}' before numeric constant
In file included from modules/batch-verification/batverify.h:7,
from modules/batch-verification/batverifyresult.cpp:4:
modules/batch-verification/hashdata.h:13:32: note: to match this '{'
enum class EHashCalculateResult{UNPROCESSED, CORRECT, ERROR, FILE_NOT_EXIST};
^
In file included from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/windows.h:71,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/rpc.h:16,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/wtypesbase.h:7,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/shlobj.h:9,
from modules/batch-verification/hashdata.h:6,
from modules/batch-verification/batverify.h:7,
from modules/batch-verification/batverifyresult.cpp:4:
modules/batch-verification/hashdata.h:13:55: error: expected unqualified-id before numeric constant
enum class EHashCalculateResult{UNPROCESSED, CORRECT, ERROR, FILE_NOT_EXIST};
^~~~~
In file included from modules/batch-verification/batverify.h:7,
from modules/batch-verification/batverifyresult.cpp:4:
modules/batch-verification/hashdata.h:13:76: error: expected declaration before '}' token
enum class EHashCalculateResult{UNPROCESSED, CORRECT, ERROR, FILE_NOT_EXIST};
^
mingw32-make: *** [makefile:40: modules/batch-verification/batverifyresult.o] Error 1
The main information here is:
error: expected unqualified-id before numeric constant
This means that when the compiler sees the identifier name in the enum, it has already been replaced by some numeric constant by the preprocessor, which is why the error occurs.
Looking at these files mentioned in the error, they might contain a lot of macros that conflict with the enum value names I defined.
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/windows.h:71,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/rpc.h:16,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/wtypesbase.h:7,
from D:/BuildTools/i686-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw32/i686-w64-mingw32/include/shlobj.h:9,
I changed the enum value name in this line of code from
to
And it compiled successfully.