/tmp/static-ebfb2f.o: In function `main':
static.cpp:(.text+0x6): undefined reference to `X::STRINGS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
#include <iostream>
struct X
{
staticconstexprconstchar* STRINGS[] = {
"blah"
// ...
};
};
// If I recall, an external definition is still required for proper linkage.
constexprconstchar* X::STRINGS[];
int main() { std::cout << X::STRINGS[0]; }