3

Here is code in log.h file :

struct SUCC_CODE{
   static const int  RECOGNIZER_OK = 0;
};

The above piece of code in log.h file throwing compiler error:

Type name does not allow storage class to be specified
jackbolo
  • 97
  • 1
  • 11
  • Possible duplicate Question[enter link description here](https://stackoverflow.com/questions/6013373/usage-of-static-within-a-struct-in-c) – Richard Wheatley May 03 '18 at 12:59

2 Answers2

2

Struct members may not be static. Remove that specifier, and the compiler should stop complaining. This question explains that it is a valid specifier in C++.

Community
  • 1
  • 1
ravron
  • 11,014
  • 2
  • 39
  • 66
0

C doesn’t allow you to use static within a struct. It’s not even clear what that would mean in a C struct.

Jeremy
  • 4,339
  • 2
  • 18
  • 12