In my code I have classes with the following structure (I use c++11):
class Foo {
public:
static constexpr double A = 3.0;
//....other....
};
Sometimes I have linker error because the static variable is not defined in cpp file. But not always. I don't understand the rule here, when is it needed to declare the static field in cpp and when not?