Quick Q: Undefined reference to static constexpr char[]

Quick A: this is no longer an issue with C++17.

Recently on SO:

Undefined reference to static constexpr char[]

Add to your cpp file:

constexpr char foo::baz[];

Reason: You have to provide the definition of the static member as well as the declaration. The declaration and the initializer go inside the class definition, but the member definition has to be separate.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.