So I get the \'initializer element not constant\' error when compiling the following code:
#include
#include
#include
According to C99 standard:
§6.7.8 Initialization
- All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals.
Using const doesn't help here because, in C, const variables are not really const. Check out this post for more details.
To work out, you can make wl constant by using preprocessor:
#define wl 2.0f
By doing this, 2.0f * (float) M_PI / wl can be a compile time constant.