You must add the following line in the implementation file:
int Foo::bar = you_initial_value_here;
This is required so the compiler has a place for the static variable.
More Related Contents:
- Unresolved external symbol on static class members
- Static constant string (class member)
- How do you create a static class in C++?
- Do static members of a class occupy memory if no object of that class is created?
- Questions regarding constructors
- c++ access stuff out side the class [closed]
- Why is enum class preferred over plain enum?
- Undefined reference to static variable c++
- Destruction order of static objects in C++
- C++ Overload Static Function with Non-Static Function
- Does static constexpr variable inside a function make sense?
- How can I get the class name from a C++ object?
- Are static variables in a base class shared by all derived classes?
- How do you determine the size of an object in C++?
- C++ class header files organization
- What is the difference between a static and const variable?
- How to add constructors/destructors to an unnamed class?
- How to use WndProc as a class function [duplicate]
- Class template with template class friend, what’s really going on here?
- C++ – Why static member function can’t be created with ‘const’ qualifier
- Overriding static variables when subclassing
- Why static variable needs to be explicitly defined?
- What does “operator = must be a non-static member” mean?
- How to create a template function within a class? (C++)
- No matching function for call to Class Constructor
- Undefined reference to a static member of the class
- passing object by reference in C++
- Can you start a class name with a numeric digit?
- What is the purpose of forward declaration?
- Scope resolution operator being used twice