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
2571 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
|
7月前
|
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
91 1
|
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
224 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
|
Linux
编译OpenJDK8:error: control reaches end of non-void function [-Werror=return-type]
编译OpenJDK8:error: control reaches end of non-void function [-Werror=return-type]
194 0
|
C++
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
201 0
|
JSON Go 数据格式
解决:interface conversion: interface {} is float64, not int
今天遇到一个小坑,但是自己陷进去好久,说起来有些不好意思,但是感觉还是应该拿出来晒一晒,希望大家别再被类似的问题耽误了。
1093 0
delete attempted to return null from a method with a primitive return type (int)
今天被自己给蠢死了 今天在代码中遇到这个错误, 百度翻译一下:映射方法,从一org.system.mapper.child.chmorganizationexaminationmapper.delete返回零作为一个原始的方法的返回类型(int)。
2912 0