constant variables not working in header

后端 未结 10 1981
悲&欢浪女
悲&欢浪女 2020-11-30 20:10

if I define my constant varibles in my header like this...

extern const double PI = 3.1415926535;
extern const double PI_under_180 = 180.0f / PI;
extern cons         


        
10条回答
  •  一生所求
    2020-11-30 20:31

    in declaring global const within header causes that each compilation unit including this hader will have own definitions global definitions with the same name. Then linker does not like that.

    If You really need these in header then probably You should declare them as static.

提交回复
热议问题