I have a class which is essentially just holds a bunch of constant definitions used through my application. For some reason though, long
s compile but float
s do not:
class MY_CONSTS
{
public :
static const long LONG_CONST = 1; // Compiles
static const float FLOAT_CONST = 0.001f; // C2864
};
Gives the following error:
1>c:projectsmyprojectConstant_definitions.h(71) : error C2864: 'MY_CONSTS::FLOAT_CONST' : only static const integral data members can be initialized within a class
Am I missing something?
See Question&Answers more detail:os