#Why am I getting this error?
7 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
As I understand it, for const static members, you must only declare the variable in the class definition, and then actually define it out of the class (usually in a cpp file)
Haven't done this is a while, so I'm fuzzy on the details
Fairly close
Excluding some exceptions, any static member variable had to have an out-of-class definition/initializer
Then c++17 introduced inline and constexpr variables, so now with the right set of keywords you are allowed to have more in-class initialization
Because that's just literally not allowed
If you're asking for practical and historic reasons then yeah we can talk about that, but that aside you can just stick constexpr there
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.