Search code examples
c++global-variablesexternstorage-class-specifier

storage class specified for 'FileCase' error


I tried to compile some code however am getting the error

  storage class specified for 'FileCase'

What does this error mean?

Does it have to do with the fact I have declared it as an extern int in the private part of the header file ?

I am unable to resolve the issue. In the cpp file, I have declared it as

  int FileCase =0; 

inside of the function where it is needed however it does not resolve the problem. Does anyone know what the issue could be?

Thanks

Jis


Solution

  • in the .h file you should have:

    extern int FileCase; but not in a class...

    and in the cpp file you should have a global variable:

    int FileCase = initializer;