Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a C code written. When I compile it on Linux then in the header file it says the following error: storage class specified for parameter i32 , i8 and so on

typedef int i32;
typedef char    i8;
                I got this eror when I was daydreaming and declared a memebr function as extern in the class definition (slides off sheepishly, cheeks aflame)
– Mawg says reinstate Monica
                Apr 21, 2017 at 9:54
                This. The error likely gets reported in some source code file you are sure you didn't touch—but that file happens to include the header file which has the syntax error.
– user149408
                Jan 31, 2018 at 16:01
                it does not need to be a semicolon. It can also be a curly bracket { lost in the lost that needs to be removed
– Miguel Tomás
                Mar 14 at 19:07

i had the same experience. The problem was at the function prototype declaration in the header file where a semi colon was missing at the end of function declaration.

The function was indicated in the compilation logs as "In function ... " just before the error snippet

Hope this helps!!

You have some code somewhere, probably indicated in the full text of the error message, that does something like this:

void function(static int foo)

The static is not allowed there. It could also be another storage class, like register or extern.

I incurred this same error once. The solution was to browse around files and look for pending statements (like a non-closed parenthesis, or a missing semicolon.) Usually it's really a trivial error, but the compiler complains.

The bad news is that it doesn't always complain at the right line (or even in the right file!) The good news is that in these cases it says something useful like:

WRONGFILE.h: In function ‘FUNCTION_OF_ANOTHER_FILE_WRT_WRONG_FILE’"
WRONGFILE:line:col: error: storage class specified for parameter ‘param’ before. 

Go and check in that other reported file.

To add up on ;: another case can be a missing ) in a function pointer declaration:

extern void init_callbacks(void (*init)(), void (*end());

(missing closing parenthesis after *end).

I had similar issue, while error was missing the storage class name in static assignment. E.g.:

class MyClass { static const int something; .cpp: const int something = 1; // returns error const int MyClass::something = 1; // OK

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.