jackbolo
jackbolo

Reputation: 97

Type name does not allow storage class to be specified?

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

Upvotes: 3

Views: 5265

Answers (2)

Jeremy
Jeremy

Reputation: 4381

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

Upvotes: 0

ravron
ravron

Reputation: 11211

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++.

Upvotes: 2

Related Questions