--- MORE LINES ---
// The display monitor dimensions
struct DISPLAY_MONITOR_DIMENSIONS
{
uint8 u8TotMonitors;
RECT pRect[64];
HMONITOR phMonitors[64];
DISPLAY_MONITOR_DIMENSIONS()
{
// Clear the variables
u8TotMonitors = 0;
memset(pRect, NULL, sizeof(pRect));
memset(phMonitors, NULL, sizeof(phMonitors));
}
};
// The taskbar position
enum class TASKBAR_POS
{
left, // The taskbar is on the left side of the screen
top, // The taskbar is on the top side of the screen
right, // The taskbar is on the right side of the screen
bottom // The taskbar is on the bottom side of the screen
};
// Function prototypes
MISCELLANEOUS_EXP void AppendTextToEditBox(HWND hWndEditbox, const wchar_t *pwcNewText, int32 i32Len = -1);
MISCELLANEOUS_EXP bool CheckMemProblem(int8 *pi8Mem, int32 i32Bytes);
MISCELLANEOUS_EXP void ClipRect(RECT *pRc, const RECT *pRcClip);
MISCELLANEOUS_EXP bool CopyDataToClipboard(const void *pvData, int32 i32Len, uint32 u32Format = CF_UNICODETEXT);
--- MORE LINES ---
I get 'syntax error' on this line:
enum class TASKBAR_POS
I'm using enum class in other places and I don't get any error there, so enum class seems to be supported by CppCheck.
Can someone tell me why I'm getting a syntax error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the following in a header:
I get 'syntax error' on this line:
enum class TASKBAR_POS
I'm using enum class in other places and I don't get any error there, so enum class seems to be supported by CppCheck.
Can someone tell me why I'm getting a syntax error?
I don't know. And I can't reproduce with your code. Can you reproduce if you just put that code in a file and check it? Or is more stuff required?
See https://sourceforge.net/p/cppcheck/discussion/general/thread/8d40c994/
Is your "enum class" in a .h file? Cppcheck parses .h files as C code and there is no enum class in C.
You can force Cppcheck to parse it as C++ code with --language=c++. Does it work then?
I updated to 1.87 from 1.86. Now I am having this issue. I tried to use the fix --language=c++, but doesn't work
Hello!
Having the same problem on 1.87.
MyHeaderFile.h
CPPcheck reports a syntax error on the Enum line. --language=c++ doesn't help.
The error is reported regardless if "enum" or "enum class" is used.
Last edit: Sergey Burgsdorf 2019-04-23
Do you have:
#define ErrorCode something
ortypedef something ErrorCode
; somewhere?My problem was fixed, because the enums were already declared in another library that I was using.
These were already used, so when I changed the names in enum, my problem was resolved.