I am writing a serial library using boost and I have an enum:
enum parity_t { PARITY_NONE, PARITY_ODD, PARITY_EVEN };
I get errors like:
Error 1 error C2059: syntax error : '('
I couldn't figure out what the issue was. Then my friend and I tried:
void PARITY_NONE();
And we got these errors:
Error 1 error C2143: syntax error : missing ')' before 'constant'
Error 2 error C2143: syntax error : missing ';' before 'constant'
Error 3 error C2182: 'WORD' : illegal use of type 'void'
Error 4 error C2059: syntax error : ')'
I am including boost asio, which I figure is including the Windows serial api somewhere. This only occurs in Windows. As a work around I have changed my enumeration names. I cannot, however, find anything related to this issue on the internet. Can someone help us figure this out?
It's defined in winbase.h:
//
// Settable Stop and Parity bits.
//
#define STOPBITS_10 ((WORD)0x0001)
#define STOPBITS_15 ((WORD)0x0002)
#define STOPBITS_20 ((WORD)0x0004)
#define PARITY_NONE ((WORD)0x0100)
#define PARITY_ODD ((WORD)0x0200)
#define PARITY_EVEN ((WORD)0x0400)
#define PARITY_MARK ((WORD)0x0800)
#define PARITY_SPACE ((WORD)0x1000)
#undef
them before creating your enum.