In a header file I have the following enum:
namespace OBJ_VERBS {
enum { zero,
CUDDLE, EMBRACE, FLIP, GROPE, HUG,
KISS, LICK, NUDGE, PAT, PINCH,
POKE, PULL, RUB, SHAKE, SQUEEZE,
TAP, TUG, TURN, WAVE, PEER,
PET, CLENCH, CURSE, NUZZLE, SNAP,
STROKE, TWIRL, LEAN, GRIP, SMELL,
GRUNT, SQUEAL, SCOLD, GAZE, WIND,
SPIT, SPIN, DANCE, SING,
zTOTAL};
const int _MAX_ = int(OBJ_VERBS::zTOTAL - 1);
}
I get the following error: Error: expected an identifier
I tried searching the web to see if "SING" was a keyword, but it's not.
Any ideas?
I am betting you are including (directly or indirectly) math.h
.
A little investigation reveals:
$ grep -r -w SING /usr/include/
/usr/include/math.h:#define SING 2
As it's #define
d to 2, the enum
attempts to use 2
as an enum member, which fails with the error given above.
Note that I'm (necessarily) guessing what's happening here based on the include files I have locally. It's possible you have something entirely different causing the issue, but the most likely culprit is a #define
in an include file. See the grep
I used above for how I found it.
This is why it's often a good idea to use (e.g.) OV_CUDDLE
, OV_EMBRACE
etc., to minimise collisions.
For what it's worth, the context of SING
in math.h
is:
/* Types of exceptions in the `type' field. */
# define DOMAIN 1
# define SING 2
# define OVERFLOW 3
# define UNDERFLOW 4
# define TLOSS 5
# define PLOSS 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With