Static function: a storage class may not be specified here

In the definition in the .cpp file, remove the keyword static:

// No static here (it is not allowed)
std::string neighborAtt::intToStr(int number)
{
    ...
}

As long as you have the static keyword in the header file, the compiler knows it’s a static class method, so you should not and cannot specify it in the definition in the source file.

In C++03, the storage class specifiers are the keywords auto, register, static, extern, and mutable, which tell the compiler how the data is stored. If you see an error message referring to storage class specifiers, you can be sure it’s referring to one of those keywords.

In C++11, the auto keyword has a different meaning (it is no longer a storage class specifier).

Leave a Comment

File not found.