Where do you declare a constant in Objective-C?

后端 未结 4 1631
故里飘歌
故里飘歌 2020-12-07 18:54

I declared a constant in a header file const double EARTH_RADIUS=6353; that is imported to various other headers and I got a linker error.

L         


        
4条回答
  •  孤城傲影
    2020-12-07 19:19

    Best practice would be to declare it in your .h and .m files. See Constants in Objective-C for a very detailed set of answers regarding this same question.

提交回复
热议问题