C ++ Warning. ID expected instead of "}"

I received this warning when I declare one listing

enum Mask {
  NONE = 0,
  L = 1,
  H =2,
  U =4,
  V =8,
  D = 0X10,
  E = 0X20,
  P = 0X40,
  Q = 0X80,
};

typedef std::vector<Mask> MaskVec;

I think this warning comes from an enum declaration. Could you help me point out the problem?

thank

+3
source share
2 answers

Your code contains an extra comma.

enum Mask {
  NONE = 0,
  L = 1,
  H =2,
  U =4,
  V =8,
  D = 0X10,
  E = 0X20,
  P = 0X40,
  Q = 0X80 //You placed an extra comma here
};
+10
source

Try removing the comma after the last member enum.

+5
source

All Articles