I have a simple config struct defined in a header that contains a series of other simple structs that are just containers for static variables. Here's an example:
// Config.h struct Config { struct Server { static constexpr const char* url = "http://example.com"; static constexpr float polling_interval = 1.0f; }; struct Window { static constexpr int width = 1920; static constexpr int height = 1200; }; }; I include the header file where I need it and access the variables like this: Config::Window::width
This works fine but at a certain point I needed to load the values from a file so I changed the variable declarations to not be constants (e.g. static constexpr int width = 1920; became static int width;). Now the linker complains of undefined symbols for the variables. Isn't the linkage for static constexpr objects the same as for static objects? Is there something else I'm missing?