Weird undefined symbols of static constants inside a struct/class
问题 Either I'm very tired or something weird is happening that I'm not aware of, because the code below is resulting in undefined symbols for Foo::A and Foo::B when linking . This is minimized as much as I could from a larger project, but shows the essence of what I'm looking at. #include <algorithm> struct Foo { static const int A = 1; static const int B = 2; }; int main() { return std::min(Foo::A, Foo::B); } Without the std::min function template it works fine , i.e. just return Foo::A. Also