VS2005 error C2864 only static const integral data members can be initialized within a class

简介: VS2005 error C2864 only static const integral data members can be initialized within a class

only static const integral data members can be initialized within a class

只要静态常量int 类型成员变量可以在类内部初始化。


only static const integral data members can be initialized within a class

1>生成日志保存在“file://e:\test\testexe\testexe\Debug\BuildLog.htm”

class CTest
{
public:
 static const short m_y =3;//正确
 //static short  m_z = 3; //错误
 //const short m_z =3;//错误
 static const long m_y1 = 4; //正确
 static const unsigned short m_y2 = 5;//正确
 //static const float m_z = 6;//错误
};
相关文章
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
Error: Element type is invalid: expected a string (for built-in components) or a class/function
2552 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
|
6月前
|
JavaScript
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
79 1
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
122 0
|
SQL Java 数据库连接
attempted to return null from a method with a primitive return type
attempted to return null from a method with a primitive return type
190 0
Dart报The return type ‘bool‘ isn‘t a ‘void‘, as required by the closure‘s context
Dart报The return type ‘bool‘ isn‘t a ‘void‘, as required by the closure‘s context
|
关系型数据库 MySQL C++
Error:E0415 no suitable constructor exists to convert from “int“ to “Rational“
Error:E0415 no suitable constructor exists to convert from “int“ to “Rational“
170 0
TypeError: sequence item 0: expected string, int found
TypeError: sequence item 0: expected string, int found