Forever
Do not lose heart,you will be successful sooner or later。

在c++中const是内连接的,其意思就是说在头文件中定义了const,那么在包含这个头文件的任何一个编译单元中都会重编一个const,不会影响的。

但是如果在头文件中没有定义的话,就要加extern 在头文件中,定义在cpp中,这样使其具有外连接。要不在其他的cpp中是找不到这个变量的定义的。

出现 error C2734: 'a' : const object must be initialized if not extern

posted on 2012-05-15 11:43  sybtj  阅读(297)  评论(0编辑  收藏  举报